MCG31m1

This is a 31-bit multiplicative congruential generator:

  

MCG31m1 belongs to linear congruential generators with the period length of approximately 231. Such generators are still used as default random number generators in various software systems, mainly due to the simplicity of the portable versions implementation, speed and compatibility with the earlier systems versions. However, their period length does not meet the requirements for modern basic generators. Still, the MCG31m1 generator possesses good statistic properties and you may successfully use it to generate random numbers of different distributions for small samplings.

Real Implementation (Single and Double Precision)

The output vector is the sequence of the floating-point values u0, u1, ...

Integer Implementation

The output vector of 32-bit integers x0, x1, ...

Stream Initialization by Function vslNewStream

MCG31m1 generates the stream and initializes it specifying the input 32-bit parameter seed :

  1. Assume x0 = seed mod 0x7FFFFFFF

  2. If x0 = 0, assume x0 = 1.

Stream Initialization by Function vslNewStreamEx

MCG31m1 generates the stream and initializes it specifying the array params[] of n 32-bit integers:

  1. If n = 0, assume x0 = 1

  2. Otherwise, assume x0 = params[0] mod 0x7FFFFFFF
    If x0 = 0, assume x0 = 1.

Subsequences Selection Methods

vslSkipAheadStream

supported

vslLeapfrogStream

supported

vslSkipAheadStream

supported

vslLeapfrogStream

supported

Generator Period

Lattice Structure

M8 = 0.72771, M16 = 0.61996, M32 = 0.61996 (for more details see [L'Ecu94]).

Empirical Testing Results Summary

Test Name

vsRngUniform

vdRngUniform

viRngUniform

viRngUniformBits

3D Spheres Test

OK (10% errors)

OK (10% errors)

Not applicable

OK (10% errors)

Birthday Spacing Test

Not applicable

Not applicable

Not applicable

OK (0% errors)

Bitstream Test

Not applicable

Not applicable

Not applicable

OK (10% errors)

Rank of 31x31 Binary Matrices Test

Not applicable

Not applicable

Not applicable

OK (10% errors)

Rank of 32x32 Binary Matrices Test

Not applicable

Not applicable

Not applicable

Not applicable

Rank of 6x8 Binary Matrices Test

Not applicable

Not applicable

Not applicable

OK (0% errors)

Counts-the-1’s Test (stream of bits)

Not applicable

Not applicable

Not applicable

OK (20% errors)

Counts-the-1’s Test (stream of specific bytes)

Not applicable

Not applicable

Not applicable

OK (0% errors)

Craps Test

OK (20% errors)

OK (20% errors)

OK (20% errors)

OK (20% errors)

Parking Lot Test

OK (10% errors)

OK (10% errors)

Not applicable

OK (10% errors)

2D Self-Avoiding Random Walk Test

OK (20% errors)

OK (20% errors)

Not applicable

OK (20% errors)

Test Name

vsRngUniform

vdRngUniform

viRngUniform

viRngUniformBits

3D Spheres Test

OK (10% errors)

OK (10% errors)

Not applicable

OK (10% errors)

Birthday Spacing Test

Not applicable

Not applicable

Not applicable

OK (0% errors)

Bitstream Test

Not applicable

Not applicable

Not applicable

OK (10% errors)

Rank of 31x31 Binary Matrices Test

Not applicable

Not applicable

Not applicable

OK (10% errors)

Rank of 32x32 Binary Matrices Test

Not applicable

Not applicable

Not applicable

Not applicable

Rank of 6x8 Binary Matrices Test

Not applicable

Not applicable

Not applicable

OK (0% errors)

Counts-the-1’s Test (stream of bits)

Not applicable

Not applicable

Not applicable

OK (20% errors)

Counts-the-1’s Test (stream of specific bytes)

Not applicable

Not applicable

Not applicable

OK (0% errors)

Craps Test

OK (20% errors)

OK (20% errors)

OK (20% errors)

OK (20% errors)

Parking Lot Test

OK (10% errors)

OK (10% errors)

Not applicable

OK (10% errors)

2D Self-Avoiding Random Walk Test

OK (20% errors)

OK (20% errors)

Not applicable

OK (20% errors)

Note

  1. The tabulated data is obtained using the one-level (threshold) testing technique. The OK result indicates FAIL < 50%. The run fails when p-value falls outside the interval [0.05, 0.95].

  2. The stream tested is generated by calling the function vslNewStream with seed=7,777,777. 

For more complete information about compiler optimizations, see our Optimization Notice.
Select sticky button color: 
Orange (only for download buttons)