We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hey everyone, This is my first question at this forum,so please excuse if this is in an informal way. The thing I am wondering about is how does a random function work?.I know What a random function does,but how does it bring a random number, i mean how is the computer programmed to bring a random number? :-? . can anyone help.
Answers
https://en.wikipedia.org/wiki/Random_number_generation
@Chrisir Thanks for answering but I could not understand it completely.Could you please be more clear and explain it to me by yourself.
https://Reddit.com/r/computerscience/
For Processing specifically, the Java 7 language implements Random in java.util -- here is the reference explaining it, including citing the work that the algorithm is based on.
https://docs.oracle.com/javase/7/docs/api/java/util/Random.html
The wikipedia article that @Chrisir already gave you gives more background on "pseudorandom numbers" of this kind.
Processing then creates a function,
random()
, using java.util.Random. All the code that makesrandom()
work is in the Processing source code in the PApplet.java under the RANDOM section:https://github.com/processing/processing/blob/master/core/src/processing/core/PApplet.java#L4977
Finally, here is a general reference description of how
random()
works in processing:https://processing.org/reference/random_.html
If you have more questions about pseudorandom numbers in general, and not in Processing specifically, you should ask in general forums like the https://Reddit.com/r/computerscience/ link that @GoToLoop shared.