# 128-bit MCG Passes PractRand

As is probably evident, I've been on a bit of a PractRand binge lately. Some of the news hasn't been good, so I'll try to temper the bad news with some better news.

I'm pleased to report that truncated 128-bit multiplicative linear congruential generators (sometimes known as a Lehmer generators) pass PractRand.

### 128-bit Multiplier

First, we'll test the generator which whose essence is:

``````state *= 92563704562804186071655587898373606109;
return state >> 64;
``````

Here are the results from PractRand:

``````linux\$ ./mcg | ./RNG_test stdin64
RNG_test using PractRand version 0.93
RNG = RNG_stdin64, seed = 0x201aba44
test set = normal, folding = standard (64 bit)

rng=RNG_stdin64, seed=0x201aba44
length= 128 megabytes (2^27 bytes), time= 2.1 seconds
no anomalies in 148 test result(s)

[...]

rng=RNG_stdin64, seed=0x201aba44
length= 16 terabytes (2^44 bytes), time= 258421 seconds
no anomalies in 329 test result(s)

rng=RNG_stdin64, seed=0x201aba44
length= 32 terabytes (2^45 bytes), time= 515954 seconds
Test Name                         Raw       Processed     Evaluation
DC6-9x1Bytes-1                    R=  -4.5  p =1-8.6e-3   unusual
...and 338 test result(s) without anomalies
``````

One question here is whether this result at 32 TB is an ordinary blip, common in testing, or the start of something worse. The next test should help answer that question.

### 64-bit Multiplier

Using 92563704562804186071655587898373606109 is following standard practice, since it's a 128-bit constant for a 128-bit generator, but it's a bit of a pain both to enter such a constant, and for the generated code to perform the multiplication. It'd be easier if we could use a 64-bit multiplier instead, so that's what I tried.

So for this test, I used 15750249268501108917. That's not the best possible constant, with an 8-dimensional spectral test result of 0.633, but it's reasonable. Let's see how it does.

``````linux\$ ./mcg-fast | ./RNG_test stdin64
RNG_test using PractRand version 0.93
RNG = RNG_stdin64, seed = 0x763044db
test set = normal, folding = standard (64 bit)

rng=RNG_stdin64, seed=0x763044db
length= 128 megabytes (2^27 bytes), time= 2.5 seconds
Test Name                         Raw       Processed     Evaluation
[Low1/64]BCFN(2+4,13-8,T)         R=  -4.6  p =1-2.6e-4   unusual
...and 147 test result(s) without anomalies

rng=RNG_stdin64, seed=0x763044db
length= 256 megabytes (2^28 bytes), time= 5.5 seconds
no anomalies in 159 test result(s)

rng=RNG_stdin64, seed=0x763044db
length= 512 megabytes (2^29 bytes), time= 10.8 seconds
no anomalies in 169 test result(s)

[...]

rng=RNG_stdin64, seed=0x763044db
length= 8 terabytes (2^43 bytes), time= 151085 seconds
no anomalies in 319 test result(s)

rng=RNG_stdin64, seed=0x763044db
length= 16 terabytes (2^44 bytes), time= 300042 seconds
no anomalies in 329 test result(s)

rng=RNG_stdin64, seed=0x763044db
length= 32 terabytes (2^45 bytes), time= 605024 seconds
no anomalies in 339 test result(s)
``````

Here we got a minor blip in the first result (not uncommon), but nice clean results at the end.

Looks good to me!