<< Chapter < Page | Chapter >> Page > |
Consider
Fortunately, one a value of the m has been selected; theoretical results exist that give conditions for choosing values of the multiplier a and the additive constant c such that all the possible integers, 0 through , are generated before any are repeated.
THEOREM I
A linear congruential generator will have maximal cycle length m , if and only if:
PROOF
As a mathematical note, c is called relatively prime to m if and only if c and m have no common divisor other than 1, which is equivalent to c and m having no common prime factor.
A related result concerns the case of c chosen to be 0. This case does not conform to condition in a Theorem I , a value of zero must be avoided because the generator will continue to produce zero after the first occurrence of a zero. In particular, a seed of zero is not allowable. By Theorem I , a generator with , which is called a multiplicative congruential generator , cannot have maximal cycle length m . However, By Theorem II . It can have cycle length .
THEOREM II
If in a linear congruential generator, then can never be included in a cycle, since the 0 will always repeat. However, the generator will cycle through all integers in the set if and only if:
PROOF
A formal definition or primitive elements modulo m , as well as theoretical results for finding them, are given in Knuth (1981) . In effect, when m is a prime, a is a primitive element if the cycle is of length . The results of Theorem II are not intuitively useful, but for our purposes, it is enough to note that such primitive elements exist and have veen computed by researchers,
Another method frequency speeding up a random number generator that has is to choose the modulus m to be computationally convenient. For instance, consider This is clearly not a prime number, but on a computer the modulus operation becomes a bit-shift operation in machine code. In such cases, Theorem III gives a guise to the maximal cycle length.
THEOREM III
If and with , then the maximal possible cycle length is . This is achieved if and only if two conditions hold:
PROOF
Notice that we sacrifice some of the cycle length and, as we will se in Theorem IV, we also lose some randomness in the low-order bits of the random variates. Having use any of Theorems I , II , or III to select triples ( a, c, m ) that lead to generators with sufficiently long cycles of known length, we can ask which triple gives the most random (i.e., approximately independent ) sequence. Although some theoretical results exist for generators as a whole, these are generally too weak to eliminate any but the worst generators. Marsaglia (1985) and Knuth(1981, Chap. 3.3.3) are good sources for material on that results.
THEOREM IV
If , and we define
PROOF
Such normal behavior in the low-order bits of a congruential generator with non-prime-modulus m is an undesirably property, which may be aggravated by techniques such as the recycling of uniform variates. It has been observed (Hutchinson, 1966) that prime-modulus multiplicative congruential generators with full cycle (i.e., when m is a positive primitive element) tend to have fairly randomly distributed low-order bits, although no theory exists to explain this.
THEOREM V
If our congruential generator produces the sequence , and we look at the following sequence of points in n dimensions:
PROOF
Given these known limitations of congruential generator, we are still left with the question of how to choose the “best” values for a , c , and m . To do this, researchers have followed a straightforward but time-consuming procedure:
Notification Switch
Would you like to follow the 'Introduction to statistics' conversation and receive update notifications?