Marsaglia's theorem

From HandWiki
Short description: Describes flaws with the pseudorandom numbers from a linear congruential generator

In computational number theory, Marsaglia's theorem connects modular arithmetic and analytic geometry to describe the flaws with the pseudorandom numbers resulting from a linear congruential generator. As a direct consequence, it is now widely considered that linear congruential generators are weak for the purpose of generating random numbers. Particularly, it is inadvisable to use them for simulations with the Monte Carlo method or in cryptographic settings, such as issuing a public key certificate, unless specific numerical requirements are satisfied. Poorly chosen values for the modulus and multiplier in a Lehmer random number generator will lead to a short period for the sequence of random numbers. Marsaglia's result may be further extended to a mixed linear congruential generator. [1]

For example, with RANDU, we have [math]\displaystyle{ m = 2^{32} }[/math], and in three dimensions, it shows that all the points fall into at most [math]\displaystyle{ floor((2^{31}\times 3!)^{1/3}) = 2344 }[/math] planes. The actual RANDU algorithm, which uses [math]\displaystyle{ k = 65539 }[/math], is much worse. All the points in fact fall into 15 planes.

Three-dimensional plot of 100,000 values generated with RANDU. Each point represents 3 consecutive pseudorandom values. It is clearly seen that the points fall in 15 two-dimensional planes.

Main statement

Consider a Lehmer random number generator with

[math]\displaystyle{ r_{i+1} \equiv kr_i\mod m }[/math]

for any modulus [math]\displaystyle{ m }[/math] and multiplier [math]\displaystyle{ k }[/math] where each [math]\displaystyle{ 0\lt r_i \lt m }[/math], and define a sequence

[math]\displaystyle{ u_1 = \frac{r_1} m, u_2 = \frac{r_2} m, u_3 = \frac{r_3} m , \ldots }[/math]

Define the points

[math]\displaystyle{ \pi_1 = (u_1, \ldots, u_n), \pi_2 = (u_2, \ldots, u_{n+1}), \pi_3 = (u_3, \ldots, u_{n+2}), \ldots }[/math]

on a unit [math]\displaystyle{ n }[/math]-cube formed from successive terms of the sequence of [math]\displaystyle{ u }[/math]. With such a multiplicative number generator, all [math]\displaystyle{ n }[/math]-tuples of resulting random numbers lie in at most [math]\displaystyle{ (n!m)^{1/n} }[/math] hyperplanes. Additionally, for a choice of constants [math]\displaystyle{ c_1,c_2, \ldots, c_n }[/math] which satisfy the congruence

[math]\displaystyle{ c_1 + c_2k+c_3k^2 + \cdots + c_n k^{n-1} \equiv 0 \mod m, }[/math]

there are at most [math]\displaystyle{ |c_1| + |c_2| + \cdots + |c_n| }[/math] parallel hyperplanes which contain all [math]\displaystyle{ n }[/math]-tuples produced by the generator. Proofs for these claims may be found in Marsaglia's original paper. [2]

References