Generating Random Numbers

Computer generation of completely random numbers by a computer is not possible because computers are deterministic because computers do precisely what they are told by the programs that run on them, and do not allow chance to interfere in calculations. In practice however, we can generate numbers that are almost random.

Suppose we want to randomly generate numbers from the interval [0, 1]. The generated numbers must have the following properties:

Each number in the interval is as likely to be chosen as any other number. In practice this means that over a long period of time the number of random numbers in each subinterval [a, b] of [0, 1] should be proportional to the length of the interval b − a. This is not a sufficient requirement because if [0,1] were divided into the intervals [0,0.25] and (0.25,1] then the sequence 0,0.5,0.5,0.5,0,0.5,0.5,0.5,0,0.5,0.5,0.5,... would satisfy this requirement while not being random.

To try to remedy this deficiency we might require that ordered pairs of random numbers (x,y) are distributed uniformly over the unit square [0, 1] × [0, 1].The proportion of pairs falling

in part of the square [0, 1] × [0, 1] will be proportional to the area of that part. In fact we can make this requirement for higher dimensional unit squares [0,1]^n .The highest dimension n such that the random number generator produces uniformly distributed numbers in [0, 1]^n is called the order of the random number generator.

Random number generators will start to repeat the same sequence after a while. The number of calls it takes for a generator to start repeating called the period of the generator. Most generators use a hidden variable called the random seed which stores the last output and is used as an input to the generator the next time it is used. Using the same seed twice will result in the same number being generator, so that in practice the number of random numbers is limited by the number of seeds.