12.2. Random Number Generators 395
rand and drand48, using 32-bit and 48-bit integer arithmetic, respectively. Their
parameters are as follows.
rand MLCG:
a = 1103515245; M =2
31
= 2147483648; c = 12345 .
drand48 MLCG:
a = 25214903917; M =2
48
; c =11.
Note the somewhat confusing online documentation for drand48,which
reports a and c in base 8 rather than 10 (273673163155
8
and 13
8
, respectively).
We discuss some of the defects of rand and drand48 below (see also
Figure 12.2).
Lattice Structure in Linear Congruential Generators
Many statistical tests have been formulated to assess the suitability of random
number generators. Linear congruential methods, for example, are known to ex-
hibit correlations in certain hyperspaces; this basic defect is termed coarse lattice
structures. Essentially, this means that when subsets of such sequences are repre-
sented in Euclidean space (two dimensions or higher), a lattice structure emerges;
in other words, points lie on a number of hyperplanes rather than cover the space
in a random-like manner. This pattern indicates that the sequence is not truly as
random and uniform as sought. One way to visualize lattice structure is to plot
k-lag pairs of numbers of the sequence, namely {x
i
,x
i+k
} in the unit-square
plane for fixed k. Often, we plot pairs of consecutive numbers in the sequence
on the unit square and triplets of consecutive numbers in the sequence on the
unit cube.
This defect of LCG methods has been credited to G. Marsaglia in 1968; see also
[986]. Spectral tests have since been developed to measure such k-dimensional
uniformities. Such tests essentially determine the maximum distance between
adjacent hyperplanes; the larger this value, the worse the generator.
To illustrate, consider k =1-lag pairs for our simple MLCG above with
M =11and a =8(see expression in (12.8)). If we plot in two dimensions
all consecutive pairs of points, that is:
{1, 8}, {8, 9}, {9, 6}, {6, 4}, ... , {7, 1}, (12.12)
we see alarmingly that these points lie on four parallel lines with either posi-
tive and negative slopes (see Fig. 12.1). The spectral test would determine the
maximum distance between these parallel lines.
Figure 12.1 shows the lattice structure generated from the four a values that
yield full periods for this generator (˜x
i+1
=(a ˜x
i
)mod11). Clearly, defects
emerge.
You might think that this toy problem is especially misleading. Unfortu-
nately, even long LCG sequences are known to display such uniform patterns
or structures that indicate imperfect uniform sampling.
Figure 12.2 shows the structure obtained for SURAND resulting from generat-
ing 5 billion random numbers and plotting pairs (in two dimensions) and triplets