next up previous
Next: Some Good Parameter Up: Types of Generators Previous: Multiplicative Linear Congruential

Choosing the Parameters for LCGs

The period and randomness properties of linear congruential generators are highly dependent on the choice of the parameters A, C, and M. Poorly chosen values can give very small periods and bad randomness properties.

One common choice is C=0, which can speed up the generator on some computers (although on most machines a combined multiply/add is no slower than a multiply). This is called a multiplicative linear congruential generator (MLCG). In this case we must be careful to exclude zero as a seed (or the period of the generator would be 1!). The maximum period is thus M-1.

Since LCGs are mathematically very simple, analytic tests of randomness, such as the spectral test, can be used to find good parameter values.



Paul Coddington, Northeast Parallel Architectures Center at Syracuse University, paulc@npac.syr.edu