Stanford Code In Place Final+Project 3 2020 05 25 at 12 17 10 AM

by Saurabh S

Description

I have created a random number generator using an image as an input. The image pixels are used in the following formula to create a random number series which is then plotted in graph against each pixel to show a random distribution. The algorithm I used is called Linear Congruential Generator and the formula is as follows:- Xn+1 = (aXn + c) mod m I have used the following values for a, c and m since every pixel value is intrinsically random in nature. a = pixel.red c= pixel.green m=pixel.blue Also m needs to be prime and not zero so I have checked for those conditions too. This is a pseudo random number generator so I have used a product of time stamp and randint to create my first term class called seed or Xn which is passed to a function called ImageToRandom for generating the series and draw_graph for drawing a graph that shows the random number distributions against every pixel of an image. I have not used larger values for randint range because it prevents the graph from drawing a distribution but we can always use the max range upto a billion. The link to the videoshowing my project is as follows: https://www.youtube.com/watch?v=_XW7iNjd75k