606 Appendix B
Random numbers from standard generators are uniformly distributed over the
interval[0, 1]. This means that each number between 0 and 1 has the same probabil-
ity of occurrence, although in reality only values on a dense discrete set are possible
because of the finite number of bits used in the representation of the numbers. It is
also possible to make nonuniform random number generators: in that case, some
numbers have a higher probability of occurrence than others (nonuniform generat-
ors will be considered in Appendix B3). We define a distribution functionPsuch
thatP(x)dxgives us the probability of finding a random number in the interval
(x,x+dx). For the uniform distribution we have
P(x)=
{
1 for 0≤x≤ 1
0 else.
A more precise criterion for the quality of random number generators involves
the absence of correlations. The absence of correlations can be expressed in terms
of more complicated distribution functions. As an example, we would like the dis-
tribution functionP(xi,xi+ 1 ), giving the probability for the successive occurrence
of two random numbersxiandxi+ 1 , to satisfy
P(xi,xi+ 1 )=P(xi)P(xi+ 1 )=1. (B.1)
Similar conditions are required forP(xi,xj)withj−i>1 and also for distribution
functions of more than two variables.
B2 Random number generators and properties of pseudo-random numbers
In a computer, (pseudo-)random numbers are always represented by a finite number
of bits. This means that they can conveniently be interpreted as integers. If these
integer numbers are distributed uniformly, we can obtain real numbers by dividing
them by the largest integer that can be generated.
As a first example, we consider the most commonly used generator, thelinear
congruentormodulogenerator [3]. Given fixed integersa,candm,wehavethe
following prescription for generating the next random integerxifrom the previous
one (xi− 1 ):
xi=(a·xi− 1 +c)modm,i>0. (B.2)
The initial numberx 0 , which must be chosen before starting the process of generat-
ing numbers, is called theseedof the generator. A real number between 0 and 1 is
obtained by dividingxibym. In most casescis taken to be equal to 0. We now see
a problem arising whenx 0 =0: in that case, all subsequent numbers remain equal
to 0, which can hardly be taken for a random sequence. The choice for the seed
must therefore be made carefully. Sincex=0 is ruled out, the maximum number of