ID 772987
Date 12/04/2020
Public

## MCG59

This is a 59-bit multiplicative congruential generator:

Multiplicative congruential generator MCG59 is one of the two basic generators implemented in the NAG Numerical Libraries. As the module of the generator is not prime, the length of its period is not 259 but only 257, if the initial value (seed) is not an even number. The drawback of these generators is well known, (see [Cram46], [Ent98]):

1. The lower bits of the generated sequence of pseudo-random numbers are not random and thus breaking numbers down into their bit patterns and using individual bits may cause failure of random tests.

2. Block-splitting an entire period sequence into 2d identical blocks leads to their full identity in d lower bits.

### 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 the 32-bit integers is x0mod232, ⌊x0/232⌋, x1mod232, ⌊x1/232⌋, ...

Thus, the output vector stores practically every 59-bit member of the integer output as two 32-bit integers. For example, to get a vector from n 59-bit integers the size of the output array should be large enough to store 2n 32-bit numbers.

### Stream Initialization by Function vslNewStream

MCG59 generates the stream and initializes it specifying the 32-bit input integer parameter seed.

1. Assume x0 = seed mod 259.

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

### Stream Initialization of Function vslNewStreamEx

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

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

2. If n = 1, assume seed = params[0], follow the instructions described in the above section on stream initialization by the function vslNewStream.

3. Otherwise assume seed = params[0]+232*params[1], follow the instructions described in the above section on stream initialization by the function vslNewStream.

### Subsequences Selection Methods

 vslSkipAheadStream Supported vslSkipAheadStreamEx Not supported vslLeapfrogStream Supported

### Lattice Structure

S2 = 0.84; S3 = 0.73; S4 = 0.74; S5 = 0.58; S6 = 0.63; S7 = 0.52; S8 = 0.55; S9 = 0.56.

### 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)[1]
Bitstream Test Not applicable Not applicable Not applicable OK (45% errors)
Rank of 31x31 Binary Matrices Test Not applicable Not applicable Not applicable OK (0% errors)[2]
Rank of 32x32 Binary Matrices Test Not applicable Not applicable Not applicable OK (0% errors)[3]
Rank of 6x8 Binary Matrices Test Not applicable Not applicable Not applicable OK (0% errors)[4]
Counts-the-1’s Test (stream of bits) Not applicable Not applicable Not applicable FAIL (100% errors)
Counts-the-1’s Test (stream of specific bytes) Not applicable Not applicable Not applicable OK (0% errors)[5]
Craps Test OK (10% errors) OK (10% errors) OK (10% errors) OK (10% errors)
Parking Lot Test OK (20% errors) OK (20% errors) Not applicable OK (20% errors)
2D Self-Avoiding Random Walk Test OK (20% errors) OK (10% errors) Not applicable OK (10% 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.

[1] The generator fails the test for bit groups 0-23, 1-24, 2-25, 3-26, 5-28.

[2] The generator fails the test for bit groups 0-30, 1-31.

[3] The generator fails the test for bit groups 0-31, 1-32.

[4] The generator fails the test for bit groups 0-7, ..., 9-16, 11-18, 32-39, ..., 37-44, 39-46, ..., 41-48.

[5] The generator fails the test for bit groups 0-7, ..., 11-18, 13-20, ..., 15-22.