RANDU[1] is a linear congruential pseudorandom number generator (LCG) of the Park–Miller type, which was used primarily in the 1960s and 1970s.[2] It is defined by the recurrence
Vj+1=65539 ⋅ Vj\bmod231
with the initial seed number
V0
Vj
Xj
Xj=
Vj | |
231 |
.
IBM's RANDU is widely considered to be one of the most ill-conceived random number generators ever designed,[3] and was described as "truly horrible" by Donald Knuth.[4] It fails the spectral test badly for dimensions greater than 2, as shown below.
The reason for choosing these particular values for the multiplier and modulus had been that with a 32-bit-integer word size, the arithmetic of mod 231 and
65539=216+3
For any linear congruential generator with modulus m used to generate points in n-dimensional space, the points fall in no more than
(n! x m)1/n
Now we examine the values of multiplier 65539 and modulus 231 chosen for RANDU. Consider the following calculation where every term should be taken mod 231. Start by writing the recursive relation as
xk+2=(216+3)xk+1=(216+3)2xk,
which after expanding the quadratic factor becomes
xk+2=(232+6 ⋅ 216+9)xk=[6 ⋅ (216+3)-9]xk
(because)and allows us to show the correlation between three points as
xk+2=6xk+1-9xk.
Summing the absolute values of the coefficients, we get no more than 16 planes in 3D, becoming only 15 planes on closer examination, as shown in the diagram above. Even by the standards of LCGs, this shows that RANDU is terrible: using RANDU for sampling a unit cube will only sample 15 parallel planes, not even close to the upper limit of
\lfloor(231 x 3!)1/3\rfloor=2344
As a result of the wide use of RANDU in the early 1970s, many results from that time are seen as suspicious.[6] This misbehavior was already detected in 1963[7] on a 36-bit computer, and carefully reimplemented on the 32-bit IBM System/360. It was believed to have been widely purged by the early 1990s[8] but there were still FORTRAN compilers using it as late as 1999.
The start of the RANDU's output period for the initial seed
V0=1
1, 65539, 393225, 1769499, 7077969, 26542323, … .