A combined linear congruential generator (CLCG) is a
pseudo-random
A pseudorandom sequence of numbers is one that appears to be statistically random, despite having been produced by a completely deterministic and repeatable process.
Background
The generation of random numbers has many uses, such as for random ...
number generator
algorithm
In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific problems or to perform a computation. Algorithms are used as specifications for performing ...
based on combining two or more
linear congruential generator
A linear congruential generator (LCG) is an algorithm that yields a sequence of pseudo-randomized numbers calculated with a discontinuous piecewise linear equation. The method represents one of the oldest and best-known pseudorandom number generat ...
s (LCG). A traditional LCG has a
period which is inadequate for complex system simulation.
By combining two or more LCGs, random numbers with a longer period and better statistical properties can be created.
The algorithm is defined as:
where:
*
is the "
modulus" of the first LCG
*
is the ''i''
th input from the ''j''
th LCG
*
is the ''i''
th generated random integer
with:
where
is a
uniformly distributed random number between 0 and 1.
Derivation
If ''W''
''i'',1, ''W''
''i'',2, ..., ''W''
''i'',k are any independent, discrete, random-variables and one of them is uniformly distributed from 0 to ''m''
1 − 2, then ''Z''
''i'' is uniformly distributed between 0 and ''m''
1 − 2, where:
Let ''X''
''i'',1, ''X''
''i'',2, ..., ''X''
''i'',''k'' be outputs from ''k'' LCGs. If ''W''
''i'',''j'' is defined as ''X''
''i'',''j'' − 1, then ''W''
''i'',''j'' will be approximately uniformly distributed from 0 to ''m
j'' − 1.
The coefficient "(−1)
''j''−1" implicitly performs the subtraction of one from ''X''
''i'',''j''.
Properties
The CLCG provides an efficient way to calculate pseudo-random numbers. The LCG algorithm is computationally inexpensive to use.
The results of multiple LCG algorithms are combined through the CLCG algorithm to create pseudo-random numbers with a longer
period than is achievable with the LCG method by itself.
The period of a CLCG is the
least common multiple
In arithmetic and number theory, the least common multiple, lowest common multiple, or smallest common multiple of two integers ''a'' and ''b'', usually denoted by lcm(''a'', ''b''), is the smallest positive integer that is divisible by bo ...
of the periods of the individual generators, which are one less than the moduli. Since all the moduli are odd primes, the periods are even and thus share at least a common divisor of 2, but if the moduli are chosen so that 2 is the
greatest common divisor
In mathematics, the greatest common divisor (GCD) of two or more integers, which are not all zero, is the largest positive integer that divides each of the integers. For two integers ''x'', ''y'', the greatest common divisor of ''x'' and ''y'' i ...
of each pair, this will result in a period of:
Example
The following is an example algorithm designed for use in 32-bit computers:
LCGs are used with the following properties:
The CLCG algorithm is set up as follows:
The maximum period of the two LCGs used is calculated using the formula:
This equates to 2.1×10
9 for the two LCGs used.
This CLCG shown in this example has a maximum period of:
This represents a tremendous improvement over the period of the individual LCGs. It can be seen that the combined method increases the period by 9 orders of magnitude.
Surprisingly the period of this CLCG may not be sufficient for all applications.
Other algorithms using the CLCG method have been used to create pseudo-random number generators with periods as long as .
The former of the two generators, using b = 40,014 and m = 2,147,483,563, is also used by the Texas Instruments ''TI-30X IIS'' scientific calculator.
See also
*
Linear congruential generator
A linear congruential generator (LCG) is an algorithm that yields a sequence of pseudo-randomized numbers calculated with a discontinuous piecewise linear equation. The method represents one of the oldest and best-known pseudorandom number generat ...
*
Wichmann–Hill Wichmann–Hill is a pseudorandom number generator proposed in 1982 by Brian Wichmann and David Hill. It consists of three linear congruential generators with different prime moduli, each of which is used to produce a uniformly distributed number b ...
, a specific combined LCG proposed in 1982
References
External links
An overview of use and testing of pseudo-random number generators
{{DEFAULTSORT:Combined Linear Congruential Generator
Pseudorandom number generators
Modular arithmetic