NOTE: Most of the tests in DIEHARD return a p-value, which
should be uniform on [0,1) if the input file contains truly
independent random bits. Those p-values are obtained by
p=F(X), where F is the assumed distribution of the sample
random variable X---often normal. But that assumed F is just
an asymptotic approximation, for which the fit will be worst
in the tails. Thus you should not be surprised with
occasional p-values near 0 or 1, such as .0012 or .9983.
When a bit stream really FAILS BIG, you will get p's of 0 or
1 to six or more places. By all means, do not, as a
Statistician might, think that a p < .025 or p> .975 means
that the RNG has "failed the test at the .05 level". Such
p's happen among the hundreds that DIEHARD produces, even
with good RNG's. So keep in mind that " p happens".
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the BIRTHDAY SPACINGS TEST ::
:: Choose m birthdays in a year of n days. List the spacings ::
:: between the birthdays. If j is the number of values that ::
:: occur more than once in that list, then j is asymptotically ::
:: Poisson distributed with mean m^3/(4n). Experience shows n ::
:: must be quite large, say n>=2^18, for comparing the results ::
:: to the Poisson distribution with that mean. This test uses ::
:: n=2^24 and m=2^9, so that the underlying distribution for j ::
:: is taken to be Poisson with lambda=2^27/(2^26)=2. A sample ::
:: of 500 j's is taken, and a chi-square goodness of fit test ::
:: provides a p value. The first test uses bits 1-24 (counting ::
:: from the left) from integers in the specified file. ::
:: Then the file is closed and reopened. Next, bits 2-25 are ::
:: used to provide birthdays, then 3-26 and so on to bits 9-32. ::
:: Each set of bits provides a p-value, and the nine p-values ::
:: provide a sample for a KSTEST. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
BIRTHDAY SPACINGS TEST, M= 512 N=2**24 LAMBDA= 2.0000
Results for bbs.32
For a sample of size 500: mean
bbs.32 using bits 1 to 24 2.068
duplicate number number
spacings observed expected
0 62. 67.668
1 120. 135.335
2 140. 135.335
3 112. 90.224
4 40. 45.112
5 22. 18.045
6 to INF 4. 8.282
Chisquare with 6 d.o.f. = 11.29 p-value= .920159
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
bbs.32 using bits 2 to 25 1.886
duplicate number number
spacings observed expected
0 70. 67.668
1 146. 135.335
2 145. 135.335
3 77. 90.224
4 42. 45.112
5 14. 18.045
6 to INF 6. 8.282
Chisquare with 6 d.o.f. = 5.30 p-value= .493928
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
bbs.32 using bits 3 to 26 1.908
duplicate number number
spacings observed expected
0 72. 67.668
1 133. 135.335
2 151. 135.335
3 85. 90.224
4 40. 45.112
5 12. 18.045
6 to INF 7. 8.282
Chisquare with 6 d.o.f. = 5.24 p-value= .486048
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
bbs.32 using bits 4 to 27 2.022
duplicate number number
spacings observed expected
0 60. 67.668
1 137. 135.335
2 139. 135.335
3 91. 90.224
4 47. 45.112
5 22. 18.045
6 to INF 4. 8.282
Chisquare with 6 d.o.f. = 4.16 p-value= .344292
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
bbs.32 using bits 5 to 28 1.892
duplicate number number
spacings observed expected
0 73. 67.668
1 149. 135.335
2 133. 135.335
3 78. 90.224
4 46. 45.112
5 15. 18.045
6 to INF 6. 8.282
Chisquare with 6 d.o.f. = 4.66 p-value= .411396
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
bbs.32 using bits 6 to 29 1.866
duplicate number number
spacings observed expected
0 74. 67.668
1 139. 135.335
2 148. 135.335
3 83. 90.224
4 39. 45.112
5 10. 18.045
6 to INF 7. 8.282
Chisquare with 6 d.o.f. = 7.07 p-value= .685417
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
bbs.32 using bits 7 to 30 1.908
duplicate number number
spacings observed expected
0 76. 67.668
1 144. 135.335
2 135. 135.335
3 75. 90.224
4 46. 45.112
5 18. 18.045
6 to INF 6. 8.282
Chisquare with 6 d.o.f. = 4.80 p-value= .429843
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
bbs.32 using bits 8 to 31 1.974
duplicate number number
spacings observed expected
0 84. 67.668
1 129. 135.335
2 121. 135.335
3 88. 90.224
4 53. 45.112
5 14. 18.045
6 to INF 11. 8.282
Chisquare with 6 d.o.f. = 8.99 p-value= .825854
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
bbs.32 using bits 9 to 32 2.050
duplicate number number
spacings observed expected
0 71. 67.668
1 118. 135.335
2 137. 135.335
3 99. 90.224
4 50. 45.112
5 18. 18.045
6 to INF 7. 8.282
Chisquare with 6 d.o.f. = 3.99 p-value= .321564
:::::::::::::::::::::::::::::::::::::::::
The 9 p-values were
.920159 .493928 .486048 .344292 .411396
.685417 .429843 .825854 .321564
A KSTEST for the 9 p-values yields .537902
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: THE OVERLAPPING 5-PERMUTATION TEST ::
:: This is the OPERM5 test. It looks at a sequence of one mill- ::
:: ion 32-bit random integers. Each set of five consecutive ::
:: integers can be in one of 120 states, for the 5! possible or- ::
:: derings of five numbers. Thus the 5th, 6th, 7th,...numbers ::
:: each provide a state. As many thousands of state transitions ::
:: are observed, cumulative counts are made of the number of ::
:: occurences of each state. Then the quadratic form in the ::
:: weak inverse of the 120x120 covariance matrix yields a test ::
:: equivalent to the likelihood ratio test that the 120 cell ::
:: counts came from the specified (asymptotically) normal dis- ::
:: tribution with the specified 120x120 covariance matrix (with ::
:: rank 99). This version uses 1,000,000 integers, twice. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
OPERM5 test for file bbs.32
For a sample of 1,000,000 consecutive 5-tuples,
chisquare for 99 degrees of freedom=218.733; p-value=1.000000
OPERM5 test for file bbs.32
For a sample of 1,000,000 consecutive 5-tuples,
chisquare for 99 degrees of freedom=245.401; p-value=1.000000
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the BINARY RANK TEST for 31x31 matrices. The leftmost ::
:: 31 bits of 31 random integers from the test sequence are used ::
:: to form a 31x31 binary matrix over the field {0,1}. The rank ::
:: is determined. That rank can be from 0 to 31, but ranks< 28 ::
:: are rare, and their counts are pooled with those for rank 28. ::
:: Ranks are found for 40,000 such random matrices and a chisqua-::
:: re test is performed on counts for ranks 31,30,29 and <=28. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Binary rank test for bbs.32
Rank test for 31x31 binary matrices:
rows from leftmost 31 bits of each 32-bit integer
rank observed expected (o-e)^2/e sum
28 197 211.4 .983261 .983
29 5159 5134.0 .121637 1.105
30 23059 23103.0 .083977 1.189
31 11585 11551.5 .097010 1.286
chisquare= 1.286 for 3 d. of f.; p-value= .395917
--------------------------------------------------------------
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the BINARY RANK TEST for 32x32 matrices. A random 32x ::
:: 32 binary matrix is formed, each row a 32-bit random integer. ::
:: The rank is determined. That rank can be from 0 to 32, ranks ::
:: less than 29 are rare, and their counts are pooled with those ::
:: for rank 29. Ranks are found for 40,000 such random matrices ::
:: and a chisquare test is performed on counts for ranks 32,31, ::
:: 30 and <=29. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Binary rank test for bbs.32
Rank test for 32x32 binary matrices:
rows from leftmost 32 bits of each 32-bit integer
rank observed expected (o-e)^2/e sum
29 221 211.4 .434279 .434
30 5108 5134.0 .131775 .566
31 22998 23103.0 .477636 1.044
32 11673 11551.5 1.277435 2.321
chisquare= 2.321 for 3 d. of f.; p-value= .555328
--------------------------------------------------------------
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the BINARY RANK TEST for 6x8 matrices. From each of ::
:: six random 32-bit integers from the generator under test, a ::
:: specified byte is chosen, and the resulting six bytes form a ::
:: 6x8 binary matrix whose rank is determined. That rank can be ::
:: from 0 to 6, but ranks 0,1,2,3 are rare; their counts are ::
:: pooled with those for rank 4. Ranks are found for 100,000 ::
:: random matrices, and a chi-square test is performed on ::
:: counts for ranks 6,5 and <=4. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Binary Rank Test for bbs.32
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 1 to 8
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 957 944.3 .171 .171
r =5 21535 21743.9 2.007 2.178
r =6 77508 77311.8 .498 2.676
p=1-exp(-SUM/2)= .73758
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 2 to 9
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 932 944.3 .160 .160
r =5 21844 21743.9 .461 .621
r =6 77224 77311.8 .100 .721
p=1-exp(-SUM/2)= .30260
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 3 to 10
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 894 944.3 2.679 2.679
r =5 21989 21743.9 2.763 5.442
r =6 77117 77311.8 .491 5.933
p=1-exp(-SUM/2)= .94852
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 4 to 11
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 963 944.3 .370 .370
r =5 21879 21743.9 .839 1.210
r =6 77158 77311.8 .306 1.516
p=1-exp(-SUM/2)= .53132
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 5 to 12
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 922 944.3 .527 .527
r =5 21930 21743.9 1.593 2.119
r =6 77148 77311.8 .347 2.467
p=1-exp(-SUM/2)= .70866
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 6 to 13
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 936 944.3 .073 .073
r =5 21871 21743.9 .743 .816
r =6 77193 77311.8 .183 .998
p=1-exp(-SUM/2)= .39301
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 7 to 14
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 935 944.3 .092 .092
r =5 21693 21743.9 .119 .211
r =6 77372 77311.8 .047 .258
p=1-exp(-SUM/2)= .12087
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 8 to 15
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 972 944.3 .812 .812
r =5 21633 21743.9 .566 1.378
r =6 77395 77311.8 .090 1.468
p=1-exp(-SUM/2)= .51992
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 9 to 16
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 953 944.3 .080 .080
r =5 21790 21743.9 .098 .178
r =6 77257 77311.8 .039 .217
p=1-exp(-SUM/2)= .10269
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 10 to 17
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 940 944.3 .020 .020
r =5 21832 21743.9 .357 .377
r =6 77228 77311.8 .091 .467
p=1-exp(-SUM/2)= .20840
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 11 to 18
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 920 944.3 .625 .625
r =5 21806 21743.9 .177 .803
r =6 77274 77311.8 .018 .821
p=1-exp(-SUM/2)= .33676
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 12 to 19
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 946 944.3 .003 .003
r =5 22051 21743.9 4.337 4.340
r =6 77003 77311.8 1.233 5.574
p=1-exp(-SUM/2)= .93839
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 13 to 20
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 936 944.3 .073 .073
r =5 21994 21743.9 2.877 2.950
r =6 77070 77311.8 .756 3.706
p=1-exp(-SUM/2)= .84323
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 14 to 21
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 931 944.3 .187 .187
r =5 21994 21743.9 2.877 3.064
r =6 77075 77311.8 .725 3.789
p=1-exp(-SUM/2)= .84963
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 15 to 22
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 977 944.3 1.132 1.132
r =5 21871 21743.9 .743 1.875
r =6 77152 77311.8 .330 2.206
p=1-exp(-SUM/2)= .66805
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 16 to 23
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 871 944.3 5.690 5.690
r =5 21668 21743.9 .265 5.955
r =6 77461 77311.8 .288 6.243
p=1-exp(-SUM/2)= .95591
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 17 to 24
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 909 944.3 1.320 1.320
r =5 21557 21743.9 1.607 2.926
r =6 77534 77311.8 .639 3.565
p=1-exp(-SUM/2)= .83176
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 18 to 25
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 908 944.3 1.396 1.396
r =5 21907 21743.9 1.223 2.619
r =6 77185 77311.8 .208 2.827
p=1-exp(-SUM/2)= .75670
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 19 to 26
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 878 944.3 4.655 4.655
r =5 21960 21743.9 2.148 6.803
r =6 77162 77311.8 .290 7.093
p=1-exp(-SUM/2)= .97118
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 20 to 27
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 915 944.3 .909 .909
r =5 21726 21743.9 .015 .924
r =6 77359 77311.8 .029 .953
p=1-exp(-SUM/2)= .37897
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 21 to 28
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 946 944.3 .003 .003
r =5 21760 21743.9 .012 .015
r =6 77294 77311.8 .004 .019
p=1-exp(-SUM/2)= .00949
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 22 to 29
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 947 944.3 .008 .008
r =5 21897 21743.9 1.078 1.086
r =6 77156 77311.8 .314 1.400
p=1-exp(-SUM/2)= .50334
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 23 to 30
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 952 944.3 .063 .063
r =5 21789 21743.9 .094 .156
r =6 77259 77311.8 .036 .192
p=1-exp(-SUM/2)= .09171
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 24 to 31
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 920 944.3 .625 .625
r =5 21900 21743.9 1.121 1.746
r =6 77180 77311.8 .225 1.971
p=1-exp(-SUM/2)= .62670
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG bbs.32
b-rank test for bits 25 to 32
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 944 944.3 .000 .000
r =5 21714 21743.9 .041 .041
r =6 77342 77311.8 .012 .053
p=1-exp(-SUM/2)= .02615
TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices
These should be 25 uniform [0,1] random variables:
.737581 .302597 .948520 .531315 .708658
.393007 .120867 .519925 .102694 .208396
.336756 .938389 .843227 .849633 .668048
.955906 .831765 .756697 .971176 .378970
.009493 .503336 .091706 .626697 .026155
brank test summary for bbs.32
The KS test for those 25 supposed UNI's yields
KS p-value= .306570
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: THE BITSTREAM TEST ::
:: The file under test is viewed as a stream of bits. Call them ::
:: b1,b2,... . Consider an alphabet with two "letters", 0 and 1 ::
:: and think of the stream of bits as a succession of 20-letter ::
:: "words", overlapping. Thus the first word is b1b2...b20, the ::
:: second is b2b3...b21, and so on. The bitstream test counts ::
:: the number of missing 20-letter (20-bit) words in a string of ::
:: 2^21 overlapping 20-letter words. There are 2^20 possible 20 ::
:: letter words. For a truly random string of 2^21+19 bits, the ::
:: number of missing words j should be (very close to) normally ::
:: distributed with mean 141,909 and sigma 428. Thus ::
:: (j-141909)/428 should be a standard normal variate (z score) ::
:: that leads to a uniform [0,1) p value. The test is repeated ::
:: twenty times. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
THE OVERLAPPING 20-tuples BITSTREAM TEST, 20 BITS PER WORD, N words
This test uses N=2^21 and samples the bitstream 20 times.
No. missing words should average 141909. with sigma=428.
---------------------------------------------------------
tst no 1: 151580 missing words, 22.60 sigmas from mean, p-value=1.00000
tst no 2: 143620 missing words, 4.00 sigmas from mean, p-value= .99997
tst no 3: 143365 missing words, 3.40 sigmas from mean, p-value= .99966
tst no 4: 143361 missing words, 3.39 sigmas from mean, p-value= .99965
tst no 5: 143372 missing words, 3.42 sigmas from mean, p-value= .99968
tst no 6: 143372 missing words, 3.42 sigmas from mean, p-value= .99968
tst no 7: 143710 missing words, 4.21 sigmas from mean, p-value= .99999
tst no 8: 143383 missing words, 3.44 sigmas from mean, p-value= .99971
tst no 9: 143724 missing words, 4.24 sigmas from mean, p-value= .99999
tst no 10: 143749 missing words, 4.30 sigmas from mean, p-value= .99999
tst no 11: 143909 missing words, 4.67 sigmas from mean, p-value=1.00000
tst no 12: 143847 missing words, 4.53 sigmas from mean, p-value=1.00000
tst no 13: 143836 missing words, 4.50 sigmas from mean, p-value=1.00000
tst no 14: 143767 missing words, 4.34 sigmas from mean, p-value= .99999
tst no 15: 143370 missing words, 3.41 sigmas from mean, p-value= .99968
tst no 16: 143350 missing words, 3.37 sigmas from mean, p-value= .99962
tst no 17: 143388 missing words, 3.45 sigmas from mean, p-value= .99972
tst no 18: 143489 missing words, 3.69 sigmas from mean, p-value= .99989
tst no 19: 143726 missing words, 4.24 sigmas from mean, p-value= .99999
tst no 20: 143393 missing words, 3.47 sigmas from mean, p-value= .99974
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: The tests OPSO, OQSO and DNA ::
:: OPSO means Overlapping-Pairs-Sparse-Occupancy ::
:: The OPSO test considers 2-letter words from an alphabet of ::
:: 1024 letters. Each letter is determined by a specified ten ::
:: bits from a 32-bit integer in the sequence to be tested. OPSO ::
:: generates 2^21 (overlapping) 2-letter words (from 2^21+1 ::
:: "keystrokes") and counts the number of missing words---that ::
:: is 2-letter words which do not appear in the entire sequence. ::
:: That count should be very close to normally distributed with ::
:: mean 141,909, sigma 290. Thus (missingwrds-141909)/290 should ::
:: be a standard normal variable. The OPSO test takes 32 bits at ::
:: a time from the test file and uses a designated set of ten ::
:: consecutive bits. It then restarts the file for the next de- ::
:: signated 10 bits, and so on. ::
:: ::
:: OQSO means Overlapping-Quadruples-Sparse-Occupancy ::
:: The test OQSO is similar, except that it considers 4-letter ::
:: words from an alphabet of 32 letters, each letter determined ::
:: by a designated string of 5 consecutive bits from the test ::
:: file, elements of which are assumed 32-bit random integers. ::
:: The mean number of missing words in a sequence of 2^21 four- ::
:: letter words, (2^21+3 "keystrokes"), is again 141909, with ::
:: sigma = 295. The mean is based on theory; sigma comes from ::
:: extensive simulation. ::
:: ::
:: The DNA test considers an alphabet of 4 letters:: C,G,A,T,::
:: determined by two designated bits in the sequence of random ::
:: integers being tested. It considers 10-letter words, so that ::
:: as in OPSO and OQSO, there are 2^20 possible words, and the ::
:: mean number of missing words from a string of 2^21 (over- ::
:: lapping) 10-letter words (2^21+9 "keystrokes") is 141909. ::
:: The standard deviation sigma=339 was determined as for OQSO ::
:: by simulation. (Sigma for OPSO, 290, is the true value (to ::
:: three places), not determined by simulation. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
OPSO test for generator bbs.32
Output: No. missing words (mw), equiv normal variate (z), p-value (p)
mw z p
OPSO for bbs.32 using bits 23 to 32 786437******* 1.0000
OPSO for bbs.32 using bits 22 to 31 786277******* 1.0000
OPSO for bbs.32 using bits 21 to 30 786241******* 1.0000
OPSO for bbs.32 using bits 20 to 29 786367******* 1.0000
OPSO for bbs.32 using bits 19 to 28 786343******* 1.0000
OPSO for bbs.32 using bits 18 to 27 786616******* 1.0000
OPSO for bbs.32 using bits 17 to 26 786477******* 1.0000
OPSO for bbs.32 using bits 16 to 25 786234******* 1.0000
OPSO for bbs.32 using bits 15 to 24 786468******* 1.0000
OPSO for bbs.32 using bits 14 to 23 786330******* 1.0000
OPSO for bbs.32 using bits 13 to 22 786291******* 1.0000
OPSO for bbs.32 using bits 12 to 21 786436******* 1.0000
OPSO for bbs.32 using bits 11 to 20 786147******* 1.0000
OPSO for bbs.32 using bits 10 to 19 786550******* 1.0000
OPSO for bbs.32 using bits 9 to 18 786307******* 1.0000
OPSO for bbs.32 using bits 8 to 17 786296******* 1.0000
OPSO for bbs.32 using bits 7 to 16 786435******* 1.0000
OPSO for bbs.32 using bits 6 to 15 786336******* 1.0000
OPSO for bbs.32 using bits 5 to 14 786279******* 1.0000
OPSO for bbs.32 using bits 4 to 13 786373******* 1.0000
OPSO for bbs.32 using bits 3 to 12 786330******* 1.0000
OPSO for bbs.32 using bits 2 to 11 786571******* 1.0000
OPSO for bbs.32 using bits 1 to 10 786348******* 1.0000
OQSO test for generator bbs.32
Output: No. missing words (mw), equiv normal variate (z), p-value (p)
mw z p
OQSO for bbs.32 using bits 28 to 32 785994******* 1.0000
OQSO for bbs.32 using bits 27 to 31 785612******* 1.0000
OQSO for bbs.32 using bits 26 to 30 785732******* 1.0000
OQSO for bbs.32 using bits 25 to 29 785797******* 1.0000
OQSO for bbs.32 using bits 24 to 28 786024******* 1.0000
OQSO for bbs.32 using bits 23 to 27 785661******* 1.0000
OQSO for bbs.32 using bits 22 to 26 785777******* 1.0000
OQSO for bbs.32 using bits 21 to 25 785763******* 1.0000
OQSO for bbs.32 using bits 20 to 24 785831******* 1.0000
OQSO for bbs.32 using bits 19 to 23 785682******* 1.0000
OQSO for bbs.32 using bits 18 to 22 785746******* 1.0000
OQSO for bbs.32 using bits 17 to 21 785883******* 1.0000
OQSO for bbs.32 using bits 16 to 20 786026******* 1.0000
OQSO for bbs.32 using bits 15 to 19 785707******* 1.0000
OQSO for bbs.32 using bits 14 to 18 785770******* 1.0000
OQSO for bbs.32 using bits 13 to 17 785813******* 1.0000
OQSO for bbs.32 using bits 12 to 16 785893******* 1.0000
OQSO for bbs.32 using bits 11 to 15 785595******* 1.0000
OQSO for bbs.32 using bits 10 to 14 785819******* 1.0000
OQSO for bbs.32 using bits 9 to 13 785752******* 1.0000
OQSO for bbs.32 using bits 8 to 12 786004******* 1.0000
OQSO for bbs.32 using bits 7 to 11 785654******* 1.0000
OQSO for bbs.32 using bits 6 to 10 785791******* 1.0000
OQSO for bbs.32 using bits 5 to 9 785703******* 1.0000
OQSO for bbs.32 using bits 4 to 8 785815******* 1.0000
OQSO for bbs.32 using bits 3 to 7 785595******* 1.0000
OQSO for bbs.32 using bits 2 to 6 785779******* 1.0000
OQSO for bbs.32 using bits 1 to 5 785840******* 1.0000
DNA test for generator bbs.32
Output: No. missing words (mw), equiv normal variate (z), p-value (p)
mw z p
DNA for bbs.32 using bits 31 to 32 785939******* 1.0000
DNA for bbs.32 using bits 30 to 31 785646******* 1.0000
DNA for bbs.32 using bits 29 to 30 785653******* 1.0000
DNA for bbs.32 using bits 28 to 29 785595******* 1.0000
DNA for bbs.32 using bits 27 to 28 785770******* 1.0000
DNA for bbs.32 using bits 26 to 27 785640******* 1.0000
DNA for bbs.32 using bits 25 to 26 785992******* 1.0000
DNA for bbs.32 using bits 24 to 25 785451******* 1.0000
DNA for bbs.32 using bits 23 to 24 785975******* 1.0000
DNA for bbs.32 using bits 22 to 23 785780******* 1.0000
DNA for bbs.32 using bits 21 to 22 785676******* 1.0000
DNA for bbs.32 using bits 20 to 21 785657******* 1.0000
DNA for bbs.32 using bits 19 to 20 785679******* 1.0000
DNA for bbs.32 using bits 18 to 19 785575******* 1.0000
DNA for bbs.32 using bits 17 to 18 785929******* 1.0000
DNA for bbs.32 using bits 16 to 17 785502******* 1.0000
DNA for bbs.32 using bits 15 to 16 785836******* 1.0000
DNA for bbs.32 using bits 14 to 15 785630******* 1.0000
DNA for bbs.32 using bits 13 to 14 785597******* 1.0000
DNA for bbs.32 using bits 12 to 13 785600******* 1.0000
DNA for bbs.32 using bits 11 to 12 785892******* 1.0000
DNA for bbs.32 using bits 10 to 11 785658******* 1.0000
DNA for bbs.32 using bits 9 to 10 785894******* 1.0000
DNA for bbs.32 using bits 8 to 9 785477******* 1.0000
DNA for bbs.32 using bits 7 to 8 785974******* 1.0000
DNA for bbs.32 using bits 6 to 7 785653******* 1.0000
DNA for bbs.32 using bits 5 to 6 785593******* 1.0000
DNA for bbs.32 using bits 4 to 5 785588******* 1.0000
DNA for bbs.32 using bits 3 to 4 785870******* 1.0000
DNA for bbs.32 using bits 2 to 3 785617******* 1.0000
DNA for bbs.32 using bits 1 to 2 785912******* 1.0000
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the COUNT-THE-1's TEST on a stream of bytes. ::
:: Consider the file under test as a stream of bytes (four per ::
:: 32 bit integer). Each byte can contain from 0 to 8 1's, ::
:: with probabilities 1,8,28,56,70,56,28,8,1 over 256. Now let ::
:: the stream of bytes provide a string of overlapping 5-letter ::
:: words, each "letter" taking values A,B,C,D,E. The letters are ::
:: determined by the number of 1's in a byte:: 0,1,or 2 yield A,::
:: 3 yields B, 4 yields C, 5 yields D and 6,7 or 8 yield E. Thus ::
:: we have a monkey at a typewriter hitting five keys with vari- ::
:: ous probabilities (37,56,70,56,37 over 256). There are 5^5 ::
:: possible 5-letter words, and from a string of 256,000 (over- ::
:: lapping) 5-letter words, counts are made on the frequencies ::
:: for each word. The quadratic form in the weak inverse of ::
:: the covariance matrix of the cell counts provides a chisquare ::
:: test:: Q5-Q4, the difference of the naive Pearson sums of ::
:: (OBS-EXP)^2/EXP on counts for 5- and 4-letter cell counts. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Test results for bbs.32
Chi-square with 5^5-5^4=2500 d.of f. for sample size:2560000
chisquare equiv normal p-value
Results fo COUNT-THE-1's in successive bytes:
byte stream for bbs.32 21617.59 270.364 1.000000
byte stream for bbs.32 22759.46 286.512 1.000000
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the COUNT-THE-1's TEST for specific bytes. ::
:: Consider the file under test as a stream of 32-bit integers. ::
:: From each integer, a specific byte is chosen , say the left- ::
:: most:: bits 1 to 8. Each byte can contain from 0 to 8 1's, ::
:: with probabilitie 1,8,28,56,70,56,28,8,1 over 256. Now let ::
:: the specified bytes from successive integers provide a string ::
:: of (overlapping) 5-letter words, each "letter" taking values ::
:: A,B,C,D,E. The letters are determined by the number of 1's, ::
:: in that byte:: 0,1,or 2 ---> A, 3 ---> B, 4 ---> C, 5 ---> D,::
:: and 6,7 or 8 ---> E. Thus we have a monkey at a typewriter ::
:: hitting five keys with with various probabilities:: 37,56,70,::
:: 56,37 over 256. There are 5^5 possible 5-letter words, and ::
:: from a string of 256,000 (overlapping) 5-letter words, counts ::
:: are made on the frequencies for each word. The quadratic form ::
:: in the weak inverse of the covariance matrix of the cell ::
:: counts provides a chisquare test:: Q5-Q4, the difference of ::
:: the naive Pearson sums of (OBS-EXP)^2/EXP on counts for 5- ::
:: and 4-letter cell counts. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Chi-square with 5^5-5^4=2500 d.of f. for sample size: 256000
chisquare equiv normal p value
Results for COUNT-THE-1's in specified bytes:
bits 1 to 8 2437.07 -.890 .186756
bits 2 to 9 2395.31 -1.481 .069365
bits 3 to 10 2439.90 -.850 .197680
bits 4 to 11 2506.35 .090 .535791
bits 5 to 12 2556.84 .804 .789239
bits 6 to 13 2527.62 .391 .651974
bits 7 to 14 2454.02 -.650 .257782
bits 8 to 15 2529.21 .413 .660219
bits 9 to 16 2495.93 -.058 .477027
bits 10 to 17 2464.19 -.506 .306267
bits 11 to 18 2433.76 -.937 .174453
bits 12 to 19 2538.73 .548 .708073
bits 13 to 20 2596.19 1.360 .913127
bits 14 to 21 2474.42 -.362 .358762
bits 15 to 22 2558.40 .826 .795558
bits 16 to 23 2535.67 .504 .693021
bits 17 to 24 2516.94 .240 .594658
bits 18 to 25 2431.04 -.975 .164707
bits 19 to 26 2423.80 -1.078 .140603
bits 20 to 27 2522.63 .320 .625542
bits 21 to 28 2488.43 -.164 .435011
bits 22 to 29 2572.55 1.026 .847565
bits 23 to 30 2533.52 .474 .682258
bits 24 to 31 2546.63 .659 .745177
bits 25 to 32 2536.06 .510 .694976
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: THIS IS A PARKING LOT TEST ::
:: In a square of side 100, randomly "park" a car---a circle of ::
:: radius 1. Then try to park a 2nd, a 3rd, and so on, each ::
:: time parking "by ear". That is, if an attempt to park a car ::
:: causes a crash with one already parked, try again at a new ::
:: random location. (To avoid path problems, consider parking ::
:: helicopters rather than cars.) Each attempt leads to either ::
:: a crash or a success, the latter followed by an increment to ::
:: the list of cars already parked. If we plot n: the number of ::
:: attempts, versus k:: the number successfully parked, we get a::
:: curve that should be similar to those provided by a perfect ::
:: random number generator. Theory for the behavior of such a ::
:: random curve seems beyond reach, and as graphics displays are ::
:: not available for this battery of tests, a simple characteriz ::
:: ation of the random experiment is used: k, the number of cars ::
:: successfully parked after n=12,000 attempts. Simulation shows ::
:: that k should average 3523 with sigma 21.9 and is very close ::
:: to normally distributed. Thus (k-3523)/21.9 should be a st- ::
:: andard normal variable, which, converted to a uniform varia- ::
:: ble, provides input to a KSTEST based on a sample of 10. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
CDPARK: result of ten tests on file bbs.32
Of 12,000 tries, the average no. of successes
should be 3523 with sigma=21.9
Successes: 3508 z-score: -.685 p-value: .246694
Successes: 3528 z-score: .228 p-value: .590298
Successes: 3545 z-score: 1.005 p-value: .842447
Successes: 3528 z-score: .228 p-value: .590298
Successes: 3517 z-score: -.274 p-value: .392053
Successes: 3551 z-score: 1.279 p-value: .899470
Successes: 3514 z-score: -.411 p-value: .340551
Successes: 3547 z-score: 1.096 p-value: .863437
Successes: 3550 z-score: 1.233 p-value: .891189
Successes: 3534 z-score: .502 p-value: .692266
square size avg. no. parked sample sigma
100. 3532.200 14.965
KSTEST for the above 10: p= .797436
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: THE MINIMUM DISTANCE TEST ::
:: It does this 100 times:: choose n=8000 random points in a ::
:: square of side 10000. Find d, the minimum distance between ::
:: the (n^2-n)/2 pairs of points. If the points are truly inde- ::
:: pendent uniform, then d^2, the square of the minimum distance ::
:: should be (very close to) exponentially distributed with mean ::
:: .995 . Thus 1-exp(-d^2/.995) should be uniform on [0,1) and ::
:: a KSTEST on the resulting 100 values serves as a test of uni- ::
:: formity for random points in the square. Test numbers=0 mod 5 ::
:: are printed but the KSTEST is based on the full set of 100 ::
:: random choices of 8000 points in the 10000x10000 square. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
This is the MINIMUM DISTANCE test
for random integers in the file bbs.32
Sample no. d^2 avg equiv uni
5 .4675 .2114 .374928
10 .2583 .2928 .228663
15 .3605 .2960 .303946
20 .2556 .3076 .226528
25 .0693 .3395 .067278
30 1.3575 .5066 .744436
35 .4369 .5011 .355405
40 .0138 .4597 .013770
45 .7937 .5813 .549613
50 .6344 .5587 .471426
55 .0241 .5315 .023901
60 3.6627 .6113 .974804
65 1.3575 .6199 .744436
70 .3694 .6873 .310146
75 .6123 .7046 .459585
80 .7353 .7094 .522383
85 .7950 .6967 .550237
90 .1611 .6795 .149480
95 .5772 .6819 .440182
100 2.3185 .7235 .902724
MINIMUM DISTANCE TEST for bbs.32
Result of KS test on 20 transformed mindist^2's:
p-value= .999899
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: THE 3DSPHERES TEST ::
:: Choose 4000 random points in a cube of edge 1000. At each ::
:: point, center a sphere large enough to reach the next closest ::
:: point. Then the volume of the smallest such sphere is (very ::
:: close to) exponentially distributed with mean 120pi/3. Thus ::
:: the radius cubed is exponential with mean 30. (The mean is ::
:: obtained by extensive simulation). The 3DSPHERES test gener- ::
:: ates 4000 such spheres 20 times. Each min radius cubed leads ::
:: to a uniform variable by means of 1-exp(-r^3/30.), then a ::
:: KSTEST is done on the 20 p-values. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
The 3DSPHERES test for file bbs.32
sample no: 1 r^3= 13.782 p-value= .36833
sample no: 2 r^3= 7.376 p-value= .21796
sample no: 3 r^3= 1.727 p-value= .05595
sample no: 4 r^3= 14.314 p-value= .37944
sample no: 5 r^3= 5.073 p-value= .15559
sample no: 6 r^3= 16.754 p-value= .42792
sample no: 7 r^3= 12.961 p-value= .35082
sample no: 8 r^3= 6.564 p-value= .19653
sample no: 9 r^3= 5.559 p-value= .16914
sample no: 10 r^3= 50.501 p-value= .81425
sample no: 11 r^3= 9.747 p-value= .27740
sample no: 12 r^3= 33.213 p-value= .66949
sample no: 13 r^3= 26.516 p-value= .58682
sample no: 14 r^3= 72.139 p-value= .90970
sample no: 15 r^3= 8.232 p-value= .23997
sample no: 16 r^3= 33.603 p-value= .67375
sample no: 17 r^3= 60.640 p-value= .86752
sample no: 18 r^3= 15.863 p-value= .41067
sample no: 19 r^3= 34.433 p-value= .68265
sample no: 20 r^3= 44.712 p-value= .77472
A KS test is applied to those 20 p-values.
---------------------------------------------------------
3DSPHERES test for file bbs.32 p-value= .316078
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the SQEEZE test ::
:: Random integers are floated to get uniforms on [0,1). Start- ::
:: ing with k=2^31=2147483647, the test finds j, the number of ::
:: iterations necessary to reduce k to 1, using the reduction ::
:: k=ceiling(k*U), with U provided by floating integers from ::
:: the file being tested. Such j's are found 100,000 times, ::
:: then counts for the number of times j was <=6,7,...,47,>=48 ::
:: are used to provide a chi-square test for cell frequencies. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
RESULTS OF SQUEEZE TEST FOR bbs.32
Table of standardized frequency counts
( (obs-exp)/sqrt(exp) )^2
for j taking values <=6,7,8,...,47,>=48:
-1.5 -2.4 -2.0 -3.2 3.4 -1.0
1.1 .8 1.6 1.0 .0 -1.4
.8 1.6 -2.7 -2.3 -2.7 -1.8
-3.2 3.0 .5 -1.4 2.6 1.8
1.7 8.1 -7.1 4.1 1.1 2.9
3.1 -.9 -2.1 -2.2 -2.7 3.1
3.6 -.7 -2.4 2.6 -1.3 -1.0
-1.1
Chi-square with 42 degrees of freedom:312.079
z-score= 29.468 p-value=1.000000
______________________________________________________________
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: The OVERLAPPING SUMS test ::
:: Integers are floated to get a sequence U(1),U(2),... of uni- ::
:: form [0,1) variables. Then overlapping sums, ::
:: S(1)=U(1)+...+U(100), S2=U(2)+...+U(101),... are formed. ::
:: The S's are virtually normal with a certain covariance mat- ::
:: rix. A linear transformation of the S's converts them to a ::
:: sequence of independent standard normals, which are converted ::
:: to uniform variables for a KSTEST. The p-values from ten ::
:: KSTESTs are given still another KSTEST. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Test no. 1 p-value .606056
Test no. 2 p-value .142778
Test no. 3 p-value .846881
Test no. 4 p-value .620060
Test no. 5 p-value .527181
Test no. 6 p-value .113921
Test no. 7 p-value .607919
Test no. 8 p-value .220080
Test no. 9 p-value .583735
Test no. 10 p-value .647270
Results of the OSUM test for bbs.32
KSTEST on the above 10 p-values: .474557
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the RUNS test. It counts runs up, and runs down, ::
:: in a sequence of uniform [0,1) variables, obtained by float- ::
:: ing the 32-bit integers in the specified file. This example ::
:: shows how runs are counted: .123,.357,.789,.425,.224,.416,.95::
:: contains an up-run of length 3, a down-run of length 2 and an ::
:: up-run of (at least) 2, depending on the next values. The ::
:: covariance matrices for the runs-up and runs-down are well ::
:: known, leading to chisquare tests for quadratic forms in the ::
:: weak inverses of the covariance matrices. Runs are counted ::
:: for sequences of length 10,000. This is done ten times. Then ::
:: repeated. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
The RUNS test for file bbs.32
Up and down runs in a sample of 10000
_________________________________________________
Run test for bbs.32 :
runs up; ks test for 10 p's: .932132
runs down; ks test for 10 p's: .159730
Run test for bbs.32 :
runs up; ks test for 10 p's: .741187
runs down; ks test for 10 p's: .771585
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the CRAPS TEST. It plays 200,000 games of craps, finds::
:: the number of wins and the number of throws necessary to end ::
:: each game. The number of wins should be (very close to) a ::
:: normal with mean 200000p and variance 200000p(1-p), with ::
:: p=244/495. Throws necessary to complete the game can vary ::
:: from 1 to infinity, but counts for all>21 are lumped with 21. ::
:: A chi-square test is made on the no.-of-throws cell counts. ::
:: Each 32-bit integer from the test file provides the value for ::
:: the throw of a die, by floating to [0,1), multiplying by 6 ::
:: and taking 1 plus the integer part of the result. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Results of craps test for bbs.32
No. of wins: Observed Expected
98366 98585.86
98366= No. of wins, z-score= -.983 pvalue= .16272
Analysis of Throws-per-Game:
Chisq= 27.94 for 20 degrees of freedom, p= .88911
Throws Observed Expected Chisq Sum
1 66374 66666.7 1.285 1.285
2 37435 37654.3 1.277 2.562
3 27034 26954.7 .233 2.795
4 19440 19313.5 .829 3.625
5 13925 13851.4 .391 4.015
6 10103 9943.5 2.557 6.573
7 7047 7145.0 1.345 7.917
8 5107 5139.1 .200 8.118
9 3854 3699.9 6.421 14.539
10 2650 2666.3 .100 14.638
11 1858 1923.3 2.219 16.857
12 1475 1388.7 5.358 22.215
13 1017 1003.7 .176 22.391
14 761 726.1 1.673 24.065
15 519 525.8 .089 24.153
16 371 381.2 .270 24.424
17 282 276.5 .108 24.532
18 225 200.8 2.909 27.441
19 141 146.0 .170 27.611
20 103 106.2 .097 27.708
21 279 287.1 .229 27.937
SUMMARY FOR bbs.32
p-value for no. of wins: .162720
p-value for throws/game: .889112
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Results of DIEHARD battery of tests sent to file bbs.out