Prime modulus multiplicative linear congruential generator: Difference between revisions

From SklogWiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 1: Line 1:
<math>y_{n+1}\equiv ay_n + b~~~(\mod ~m),</math>
 
:<math>y_{n+1}\equiv ay_n + b~~~(\mod ~m),</math>


The parameter <math>m</math>
The parameter <math>m</math>
Line 7: Line 8:
then the logical choice of <math>m</math> is the Mersenne prime
then the logical choice of <math>m</math> is the Mersenne prime


<math>m=2^{31} -1=2147483647</math>,
:<math>\left.m\right.=2^{31} -1=2147483647</math>,


with  <math>a=7^5</math> (a positive primitive root of <math>m</math> see Ref.s 1 and 2),
with  <math>a=7^5</math> (a positive primitive root of <math>m</math> see Ref.s 1 and 2),
Line 24: Line 25:
#[MC_1999_68_249]
#[MC_1999_68_249]
#[CPC_1997_103_0103]
#[CPC_1997_103_0103]
[[Category: Random numbers]]

Revision as of 15:56, 27 February 2007

The parameter should be prime and as large as possible without causing a numerical overflow on the computer that it is running on. For example, for a 32-bit (31 bit + 1 sign bit) word size then the logical choice of is the Mersenne prime

,

with (a positive primitive root of see Ref.s 1 and 2), and . With these parameters one is able to generate a series of pseudo-random numbers from one seed value. For an interesting discussion on how to choose an initial seed value see Ref. 3. For a list of other values of and see Ref.4 and for its use on 64-bit computers see Ref. 5.

References

  1. [CACM_1966_09_0432]
  2. [IBM_1969_02_0136]
  3. [CACM_2003_46_0090]
  4. [MC_1999_68_249]
  5. [CPC_1997_103_0103]