Update: with the help of @SqueamishOssifrage and @PaulUzdak, we discovered that my NIST SP 800-22 has a broken universal test. So this becomes a moot question.
Check this report. It seems to sail through all tests, but all p-values of the universal test fall in the first 10-percentile. I've set the generator's seed to 1. Here's my configuration of the assess
program:
$ ./assess 100000
G E N E R A T O R S E L E C T I O N
______________________________________
[0] Input File [1] Linear Congruential
[2] Quadratic Congruential I [3] Quadratic Congruential II
[4] Cubic Congruential [5] XOR
[6] Modular Exponentiation [7] Blum-Blum-Shub
[8] Micali-Schnorr [9] G Using SHA-1
Enter Choice: 0
User Prescribed Input File: mt19937-seed-1.dat
S T A T I S T I C A L T E S T S
_________________________________
[01] Frequency [02] Block Frequency
[03] Cumulative Sums [04] Runs
[05] Longest Run of Ones [06] Rank
[07] Discrete Fourier Transform [08] Nonperiodic Template Matchings
[09] Overlapping Template Matchings [10] Universal Statistical
[11] Approximate Entropy [12] Random Excursions
[13] Random Excursions Variant [14] Serial
[15] Linear Complexity
INSTRUCTIONS
Enter 0 if you DO NOT want to apply all of the
statistical tests to each sequence and 1 if you DO.
Enter Choice: 1
P a r a m e t e r A d j u s t m e n t s
-----------------------------------------
[1] Block Frequency Test - block length(M): 128
[2] NonOverlapping Template Test - block length(m): 9
[3] Overlapping Template Test - block length(m): 9
[4] Approximate Entropy Test - block length(m): 10
[5] Serial Test - block length(m): 16
[6] Linear Complexity Test - block length(M): 500
Select Test (0 to continue): 0
How many bitstreams? 10
Input File Format:
[0] ASCII - A sequence of ASCII 0's and 1's
[1] Binary - Each byte in data file contains 8 bits of data
Select input mode: 1
Statistical Testing In Progress.........
Statistical Testing Complete!!!!!!!!!!!!
$
The reason I'm using the sample size 100000 is because NIST SP 800-22 mentions it as a possible size. (See also appendix E, page 121: "[d]uring the testing phase, NIST commonly evaluated sequences on the order $10^6$.") I have no idea what is the ideal size.
------------------------------------------------------------------------------
RESULTS FOR THE UNIFORMITY OF P-VALUES AND THE PROPORTION OF PASSING SEQUENCES
------------------------------------------------------------------------------
generator is <mt19937-seed-1.dat>
------------------------------------------------------------------------------
C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 P-VALUE PROPORTION STATISTICAL TEST
------------------------------------------------------------------------------
2 1 1 0 3 0 0 1 1 1 0.534146 10/10 Frequency
4 1 1 0 1 0 0 1 0 2 0.122325 9/10 BlockFrequency
1 2 1 0 1 1 1 1 2 0 0.911413 10/10 CumulativeSums
2 0 1 0 2 0 2 1 2 0 0.534146 10/10 CumulativeSums
1 1 4 0 0 0 2 1 1 0 0.122325 10/10 Runs
1 2 1 1 0 2 1 0 0 2 0.739918 10/10 LongestRun
1 1 1 0 1 2 0 1 2 1 0.911413 10/10 Rank
0 1 0 2 1 1 1 0 3 1 0.534146 10/10 FFT
2 0 2 0 1 0 1 2 1 1 0.739918 10/10 NonOverlappingTemplate
2 2 3 0 0 1 0 0 1 1 0.350485 10/10 NonOverlappingTemplate
0 1 3 1 1 1 0 1 1 1 0.739918 10/10 NonOverlappingTemplate
3 1 0 2 1 1 0 0 1 1 0.534146 10/10 NonOverlappingTemplate
1 2 1 1 1 1 2 0 1 0 0.911413 10/10 NonOverlappingTemplate
1 2 0 2 1 0 0 2 1 1 0.739918 10/10 NonOverlappingTemplate
1 2 0 0 2 2 0 1 1 1 0.739918 10/10 NonOverlappingTemplate
1 1 3 0 0 2 2 0 0 1 0.350485 10/10 NonOverlappingTemplate
0 1 0 2 2 1 1 1 1 1 0.911413 10/10 NonOverlappingTemplate
1 1 0 0 0 1 2 1 1 3 0.534146 10/10 NonOverlappingTemplate
1 0 1 1 2 2 0 1 1 1 0.911413 10/10 NonOverlappingTemplate
1 1 0 3 0 0 2 0 1 2 0.350485 9/10 NonOverlappingTemplate
2 0 1 1 2 1 2 0 1 0 0.739918 10/10 NonOverlappingTemplate
0 3 1 1 2 1 1 0 0 1 0.534146 10/10 NonOverlappingTemplate
0 0 2 2 1 3 1 1 0 0 0.350485 10/10 NonOverlappingTemplate
3 0 1 0 1 3 2 0 0 0 0.122325 10/10 NonOverlappingTemplate
0 0 1 2 2 1 1 2 0 1 0.739918 10/10 NonOverlappingTemplate
1 0 3 1 0 0 2 1 1 1 0.534146 10/10 NonOverlappingTemplate
1 0 1 3 1 1 1 1 1 0 0.739918 10/10 NonOverlappingTemplate
2 1 2 0 0 0 0 3 1 1 0.350485 10/10 NonOverlappingTemplate
2 0 0 1 0 1 2 3 1 0 0.350485 9/10 NonOverlappingTemplate
0 1 1 1 0 0 0 4 1 2 0.122325 10/10 NonOverlappingTemplate
0 3 2 1 1 0 1 1 1 0 0.534146 10/10 NonOverlappingTemplate
1 0 0 0 3 0 2 1 3 0 0.122325 10/10 NonOverlappingTemplate
3 1 0 0 2 0 0 2 1 1 0.350485 9/10 NonOverlappingTemplate
0 1 2 1 0 0 3 2 0 1 0.350485 10/10 NonOverlappingTemplate
0 1 2 1 0 0 2 1 1 2 0.739918 10/10 NonOverlappingTemplate
0 1 1 1 0 1 1 1 2 2 0.911413 10/10 NonOverlappingTemplate
2 2 0 0 0 1 2 2 0 1 0.534146 10/10 NonOverlappingTemplate
1 1 0 2 0 1 0 0 2 3 0.350485 10/10 NonOverlappingTemplate
1 2 0 1 0 0 1 3 2 0 0.350485 10/10 NonOverlappingTemplate
1 1 1 0 0 2 2 2 1 0 0.739918 10/10 NonOverlappingTemplate
1 0 2 1 2 0 2 0 0 2 0.534146 10/10 NonOverlappingTemplate
0 2 1 1 0 1 0 3 0 2 0.350485 10/10 NonOverlappingTemplate
0 1 1 3 3 0 1 0 1 0 0.213309 10/10 NonOverlappingTemplate
0 3 1 0 1 2 0 0 2 1 0.350485 10/10 NonOverlappingTemplate
0 1 1 1 2 0 0 2 1 2 0.739918 10/10 NonOverlappingTemplate
1 1 3 1 1 0 0 1 1 1 0.739918 10/10 NonOverlappingTemplate
0 0 1 0 0 1 2 5 1 0 0.008879 10/10 NonOverlappingTemplate
1 1 0 1 1 1 1 3 0 1 0.739918 10/10 NonOverlappingTemplate
0 1 0 1 1 1 1 2 1 2 0.911413 10/10 NonOverlappingTemplate
1 1 1 0 0 1 1 2 2 1 0.911413 10/10 NonOverlappingTemplate
0 1 1 2 1 1 2 0 1 1 0.911413 10/10 NonOverlappingTemplate
0 1 0 2 1 1 3 0 1 1 0.534146 10/10 NonOverlappingTemplate
1 1 2 2 0 3 0 0 1 0 0.350485 10/10 NonOverlappingTemplate
0 3 1 1 1 1 1 0 0 2 0.534146 10/10 NonOverlappingTemplate
1 2 1 1 0 1 2 2 0 0 0.739918 10/10 NonOverlappingTemplate
0 2 0 1 1 2 3 0 1 0 0.350485 10/10 NonOverlappingTemplate
1 1 1 1 1 0 1 1 1 2 0.991468 10/10 NonOverlappingTemplate
2 0 0 2 0 1 1 2 2 0 0.534146 10/10 NonOverlappingTemplate
1 1 3 0 0 0 4 0 0 1 0.035174 10/10 NonOverlappingTemplate
0 1 1 0 1 0 1 3 0 3 0.213309 10/10 NonOverlappingTemplate
2 1 0 0 2 0 2 1 1 1 0.739918 10/10 NonOverlappingTemplate
2 1 3 1 0 0 0 0 1 2 0.350485 10/10 NonOverlappingTemplate
0 2 1 1 1 2 1 0 2 0 0.739918 10/10 NonOverlappingTemplate
2 0 0 1 0 4 0 1 1 1 0.122325 10/10 NonOverlappingTemplate
1 2 1 0 0 1 2 1 2 0 0.739918 9/10 NonOverlappingTemplate
1 1 1 2 0 0 2 0 2 1 0.739918 10/10 NonOverlappingTemplate
1 1 3 1 0 1 0 1 2 0 0.534146 10/10 NonOverlappingTemplate
0 1 3 2 0 1 0 2 1 0 0.350485 10/10 NonOverlappingTemplate
0 1 0 1 0 3 2 2 0 1 0.350485 10/10 NonOverlappingTemplate
2 1 0 2 0 0 0 4 0 1 0.066882 10/10 NonOverlappingTemplate
0 1 2 1 1 2 0 1 0 2 0.739918 10/10 NonOverlappingTemplate
3 0 1 0 1 0 1 1 0 3 0.213309 10/10 NonOverlappingTemplate
1 1 1 1 1 2 1 0 2 0 0.911413 9/10 NonOverlappingTemplate
0 1 3 0 2 0 1 1 2 0 0.350485 10/10 NonOverlappingTemplate
1 1 1 0 2 0 1 0 2 2 0.739918 10/10 NonOverlappingTemplate
0 1 0 1 3 1 0 0 3 1 0.213309 10/10 NonOverlappingTemplate
2 2 2 0 0 2 0 0 0 2 0.350485 10/10 NonOverlappingTemplate
1 3 0 0 1 3 0 2 0 0 0.122325 9/10 NonOverlappingTemplate
1 1 0 0 2 1 0 1 3 1 0.534146 9/10 NonOverlappingTemplate
0 1 0 2 1 1 2 0 1 2 0.739918 10/10 NonOverlappingTemplate
0 0 1 1 0 1 0 1 3 3 0.213309 10/10 NonOverlappingTemplate
0 0 3 3 0 0 1 1 2 0 0.122325 10/10 NonOverlappingTemplate
2 0 2 0 1 0 1 2 1 1 0.739918 10/10 NonOverlappingTemplate
0 0 3 0 2 0 0 2 2 1 0.213309 10/10 NonOverlappingTemplate
2 3 0 1 1 1 2 0 0 0 0.350485 10/10 NonOverlappingTemplate
1 1 1 0 3 1 0 1 0 2 0.534146 10/10 NonOverlappingTemplate
1 0 1 1 1 1 2 2 0 1 0.911413 10/10 NonOverlappingTemplate
0 1 0 0 1 3 1 0 2 2 0.350485 10/10 NonOverlappingTemplate
2 1 3 0 0 0 2 1 1 0 0.350485 9/10 NonOverlappingTemplate
0 0 2 1 2 2 0 0 0 3 0.213309 10/10 NonOverlappingTemplate
2 2 0 1 0 1 1 1 2 0 0.739918 10/10 NonOverlappingTemplate
0 1 1 1 0 3 1 0 0 3 0.213309 10/10 NonOverlappingTemplate
2 0 2 1 2 1 1 0 1 0 0.739918 10/10 NonOverlappingTemplate
2 2 0 1 2 1 0 0 2 0 0.534146 9/10 NonOverlappingTemplate
2 0 1 1 2 1 2 0 0 1 0.739918 10/10 NonOverlappingTemplate
1 1 0 2 0 3 2 1 0 0 0.350485 10/10 NonOverlappingTemplate
2 0 1 1 1 1 0 2 1 1 0.911413 10/10 NonOverlappingTemplate
0 1 1 2 2 0 1 0 1 2 0.739918 10/10 NonOverlappingTemplate
0 1 2 1 0 3 0 2 1 0 0.350485 10/10 NonOverlappingTemplate
1 1 2 0 2 1 2 0 0 1 0.739918 10/10 NonOverlappingTemplate
0 3 0 0 2 0 1 3 0 1 0.122325 10/10 NonOverlappingTemplate
1 0 0 1 3 1 2 1 1 0 0.534146 10/10 NonOverlappingTemplate
0 0 0 1 1 2 0 0 2 4 0.066882 10/10 NonOverlappingTemplate
1 1 0 2 1 2 1 1 1 0 0.911413 10/10 NonOverlappingTemplate
0 0 1 0 1 2 3 1 2 0 0.350485 10/10 NonOverlappingTemplate
1 4 1 0 1 0 0 0 3 0 0.035174 10/10 NonOverlappingTemplate
1 1 2 3 0 0 0 0 2 1 0.350485 10/10 NonOverlappingTemplate
1 1 0 1 2 2 2 0 1 0 0.739918 10/10 NonOverlappingTemplate
0 1 1 1 3 1 1 0 1 1 0.739918 10/10 NonOverlappingTemplate
1 0 2 0 2 1 0 1 3 0 0.350485 10/10 NonOverlappingTemplate
1 1 0 1 0 0 4 2 1 0 0.122325 9/10 NonOverlappingTemplate
2 2 1 0 3 0 1 1 0 0 0.350485 10/10 NonOverlappingTemplate
2 1 2 2 0 0 1 1 0 1 0.739918 9/10 NonOverlappingTemplate
1 0 0 1 2 2 0 0 2 2 0.534146 10/10 NonOverlappingTemplate
1 2 1 2 1 1 0 0 1 1 0.911413 9/10 NonOverlappingTemplate
2 1 0 2 0 1 3 0 1 0 0.350485 9/10 NonOverlappingTemplate
2 0 1 0 2 1 1 1 0 2 0.739918 10/10 NonOverlappingTemplate
3 2 2 0 1 0 0 0 1 1 0.350485 10/10 NonOverlappingTemplate
2 2 1 0 1 2 1 0 0 1 0.739918 10/10 NonOverlappingTemplate
1 0 2 1 1 2 2 1 0 0 0.739918 9/10 NonOverlappingTemplate
1 0 2 0 1 2 0 0 2 2 0.534146 10/10 NonOverlappingTemplate
1 2 0 0 0 1 2 2 1 1 0.739918 10/10 NonOverlappingTemplate
0 1 1 1 1 0 1 2 2 1 0.911413 10/10 NonOverlappingTemplate
1 0 2 2 0 0 2 3 0 0 0.213309 10/10 NonOverlappingTemplate
1 3 0 0 0 0 2 2 0 2 0.213309 10/10 NonOverlappingTemplate
1 0 2 2 1 1 1 0 0 2 0.739918 10/10 NonOverlappingTemplate
0 3 0 0 1 1 1 1 1 2 0.534146 10/10 NonOverlappingTemplate
1 0 1 3 0 1 2 1 0 1 0.534146 10/10 NonOverlappingTemplate
1 0 0 1 1 4 1 1 1 0 0.213309 10/10 NonOverlappingTemplate
2 0 2 0 2 0 1 1 2 0 0.534146 10/10 NonOverlappingTemplate
1 0 3 0 0 1 0 2 0 3 0.122325 10/10 NonOverlappingTemplate
2 0 2 1 0 1 1 1 1 1 0.911413 10/10 NonOverlappingTemplate
1 4 1 1 1 0 0 1 1 0 0.213309 9/10 NonOverlappingTemplate
2 1 1 1 2 0 1 0 1 1 0.911413 10/10 NonOverlappingTemplate
1 0 0 1 0 5 0 2 0 1 0.008879 10/10 NonOverlappingTemplate
1 1 0 2 1 0 1 0 4 0 0.122325 10/10 NonOverlappingTemplate
1 1 1 2 1 1 1 1 0 1 0.991468 10/10 NonOverlappingTemplate
3 3 0 0 2 0 1 0 0 1 0.122325 10/10 NonOverlappingTemplate
0 0 1 2 1 3 2 0 0 1 0.350485 10/10 NonOverlappingTemplate
1 4 0 0 0 0 1 2 0 2 0.066882 10/10 NonOverlappingTemplate
1 1 0 1 4 1 1 0 0 1 0.213309 10/10 NonOverlappingTemplate
2 0 1 0 1 0 1 2 2 1 0.739918 9/10 NonOverlappingTemplate
0 1 1 2 1 1 1 2 0 1 0.911413 10/10 NonOverlappingTemplate
0 1 1 2 1 2 1 1 1 0 0.911413 10/10 NonOverlappingTemplate
2 2 0 0 1 1 4 0 0 0 0.066882 9/10 NonOverlappingTemplate
1 1 0 1 2 3 0 1 1 0 0.534146 10/10 NonOverlappingTemplate
2 0 0 2 0 1 1 1 1 2 0.739918 10/10 NonOverlappingTemplate
2 1 0 0 2 1 0 2 1 1 0.739918 10/10 NonOverlappingTemplate
3 0 0 0 0 1 2 1 2 1 0.350485 10/10 NonOverlappingTemplate
0 1 3 0 1 1 0 1 2 1 0.534146 10/10 NonOverlappingTemplate
2 1 0 0 0 1 5 0 1 0 0.008879 10/10 NonOverlappingTemplate
1 2 1 1 2 0 2 0 1 0 0.739918 10/10 NonOverlappingTemplate
4 1 2 1 0 0 1 1 0 0 0.122325 9/10 NonOverlappingTemplate
2 0 1 2 1 1 0 1 0 2 0.739918 10/10 NonOverlappingTemplate
1 2 0 2 0 2 1 1 0 1 0.739918 10/10 NonOverlappingTemplate
0 0 3 3 0 0 1 1 2 0 0.122325 10/10 NonOverlappingTemplate
1 1 2 0 2 0 2 1 1 0 0.739918 10/10 OverlappingTemplate
10 0 0 0 0 0 0 0 0 0 0.000000 * 0/10 * Universal
1 0 1 1 2 2 3 0 0 0 0.350485 10/10 ApproximateEntropy
1 0 0 0 0 0 0 0 0 0 ---- 1/1 RandomExcursions
0 0 0 0 0 0 1 0 0 0 ---- 1/1 RandomExcursions
0 0 1 0 0 0 0 0 0 0 ---- 1/1 RandomExcursions
0 0 0 0 0 0 1 0 0 0 ---- 1/1 RandomExcursions
1 0 0 0 0 0 0 0 0 0 ---- 1/1 RandomExcursions
1 0 0 0 0 0 0 0 0 0 ---- 1/1 RandomExcursions
1 0 0 0 0 0 0 0 0 0 ---- 1/1 RandomExcursions
0 0 0 0 1 0 0 0 0 0 ---- 1/1 RandomExcursions
0 0 0 1 0 0 0 0 0 0 ---- 1/1 RandomExcursionsVariant
0 0 0 0 1 0 0 0 0 0 ---- 1/1 RandomExcursionsVariant
0 0 0 0 0 1 0 0 0 0 ---- 1/1 RandomExcursionsVariant
0 0 0 0 0 0 0 1 0 0 ---- 1/1 RandomExcursionsVariant
0 0 0 0 0 0 0 0 0 1 ---- 1/1 RandomExcursionsVariant
0 0 0 0 0 1 0 0 0 0 ---- 1/1 RandomExcursionsVariant
0 1 0 0 0 0 0 0 0 0 ---- 1/1 RandomExcursionsVariant
1 0 0 0 0 0 0 0 0 0 ---- 1/1 RandomExcursionsVariant
0 1 0 0 0 0 0 0 0 0 ---- 1/1 RandomExcursionsVariant
0 1 0 0 0 0 0 0 0 0 ---- 1/1 RandomExcursionsVariant
0 0 1 0 0 0 0 0 0 0 ---- 1/1 RandomExcursionsVariant
0 0 0 0 0 0 1 0 0 0 ---- 1/1 RandomExcursionsVariant
0 0 0 0 0 0 0 0 1 0 ---- 1/1 RandomExcursionsVariant
0 0 0 0 1 0 0 0 0 0 ---- 1/1 RandomExcursionsVariant
0 0 0 0 1 0 0 0 0 0 ---- 1/1 RandomExcursionsVariant
0 0 0 0 0 1 0 0 0 0 ---- 1/1 RandomExcursionsVariant
0 0 0 0 0 0 1 0 0 0 ---- 1/1 RandomExcursionsVariant
0 0 0 0 0 0 0 1 0 0 ---- 1/1 RandomExcursionsVariant
0 3 0 1 1 0 3 0 0 2 0.122325 10/10 Serial
1 1 0 0 2 1 1 1 2 1 0.911413 10/10 Serial
0 1 1 1 0 2 1 3 0 1 0.534146 10/10 LinearComplexity
The file containing the data is a binary file containing all numbers output by mt19937
in little-endian format. It was produced by this program
#include <random>
#include <stdio.h>
using namespace std;
int main()
{
unsigned int n;
std::minstd_rand0 generator(1);
for (;;) {
n = generator();
fwrite(&n, sizeof n, 1, stdout);
}
return 0;
}
For example, you can run
$ ./cppmt19937 > mt19937-seed-1.dat
and interrupt it after a few seconds. It'll have produced some megabytes of data.
Why is the universal test doing so well here? (FWIW, the same happens to the ranlux48
generator.)