乱数ライブラリー

Linear Congruence Method

One of the early pseudo-random number generators that is still used today due to its speed and ease of implementation. Not recommended for cryptographic use as the ``quality'' of generated numbers is insufficient. Linear Congruence Generators (LCGs) should also be avoided in geometrical simulations where there is a need to generate random points in N N dimensions due to serial correlations in the pseudo-random sequence X n X_n .

The sequence X n X_n is constructed using the following recursive equation:

X n + 1 = ( aX + c )    mod  m X_{n+1}=(aX+c)mod m

where the ``multiplier'' a a , ``increment'' c c and ``modulus'' m m are heuristic constants. The quality of pseudo-random sequences generated by LCGs depends crucially on the good choice of a a , c c and m m . The maximum period after which the sequence X n X_n will start repeating itself is equal to m m . In order to speed up computer implementations, traditionally the value of m m was chosen to be a power of 2. Values X n X_n lie in the interval [ 0, m 0,m ). To obtain a pseudo-random floating-point number from the range [ 0,1 0,1 ) , values X n X_n need to be divided by m m .



▲Back to this TOP