Pseudorandom number generator

From Simple English Wikipedia, the free encyclopedia
Jump to navigation Jump to search

A pseudorandom number generator is a way that computers generate numbers. There is no known way for a computer to generate numbers which are truly random. A computer algorithm can generate numbers which look random.

An analogy is a jar of (numbered) marbles. Humans can reach into the jar and grab "random" marbles. However, to understand pseudo random numbers, we must understand that this process is not random. We decided to reach into the bag based off of our brain giving us a signal to reach in this way, and the marbles themselves being arranged in a certain way.

Pseudo-random number generators are computer routines which tell the computer how to produce a number which looks random.

The initial position of the marbles is called the "seed." The seed is used to create the randomness. To come up with the seed some programs use time of day, while others convert background noise into a number.

When you need to get the next random number ("marble") the generator calculates it with some algorithm. It is based on the previous generated number, in turn, depending on the initial "seed." The algorithm is strict, it will always produce the same sequence of random numbers ("marbles") given the same initial "seed".