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 tetris.32
For a sample of size 500: mean
tetris.32 using bits 1 to 24 1.940
duplicate number number
spacings observed expected
0 57. 67.668
1 154. 135.335
2 142. 135.335
3 82. 90.224
4 44. 45.112
5 16. 18.045
6 to INF 5. 8.282
Chisquare with 6 d.o.f. = 6.89 p-value= .669161
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
tetris.32 using bits 2 to 25 2.066
duplicate number number
spacings observed expected
0 54. 67.668
1 124. 135.335
2 158. 135.335
3 99. 90.224
4 40. 45.112
5 17. 18.045
6 to INF 8. 8.282
Chisquare with 6 d.o.f. = 9.01 p-value= .826913
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
tetris.32 using bits 3 to 26 2.048
duplicate number number
spacings observed expected
0 58. 67.668
1 148. 135.335
2 130. 135.335
3 82. 90.224
4 53. 45.112
5 19. 18.045
6 to INF 10. 8.282
Chisquare with 6 d.o.f. = 5.31 p-value= .495614
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
tetris.32 using bits 4 to 27 2.026
duplicate number number
spacings observed expected
0 63. 67.668
1 134. 135.335
2 141. 135.335
3 93. 90.224
4 37. 45.112
5 23. 18.045
6 to INF 9. 8.282
Chisquare with 6 d.o.f. = 3.54 p-value= .261276
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
tetris.32 using bits 5 to 28 2.016
duplicate number number
spacings observed expected
0 61. 67.668
1 140. 135.335
2 131. 135.335
3 103. 90.224
4 39. 45.112
5 16. 18.045
6 to INF 10. 8.282
Chisquare with 6 d.o.f. = 4.18 p-value= .347952
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
tetris.32 using bits 6 to 29 2.036
duplicate number number
spacings observed expected
0 60. 67.668
1 140. 135.335
2 131. 135.335
3 94. 90.224
4 50. 45.112
5 18. 18.045
6 to INF 7. 8.282
Chisquare with 6 d.o.f. = 2.05 p-value= .085406
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
tetris.32 using bits 7 to 30 2.044
duplicate number number
spacings observed expected
0 71. 67.668
1 116. 135.335
2 148. 135.335
3 84. 90.224
4 56. 45.112
5 18. 18.045
6 to INF 7. 8.282
Chisquare with 6 d.o.f. = 7.37 p-value= .711806
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
tetris.32 using bits 8 to 31 2.118
duplicate number number
spacings observed expected
0 67. 67.668
1 124. 135.335
2 130. 135.335
3 90. 90.224
4 54. 45.112
5 26. 18.045
6 to INF 9. 8.282
Chisquare with 6 d.o.f. = 6.49 p-value= .629163
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
tetris.32 using bits 9 to 32 2.098
duplicate number number
spacings observed expected
0 68. 67.668
1 120. 135.335
2 130. 135.335
3 102. 90.224
4 54. 45.112
5 14. 18.045
6 to INF 12. 8.282
Chisquare with 6 d.o.f. = 7.81 p-value= .747946
:::::::::::::::::::::::::::::::::::::::::
The 9 p-values were
.669161 .826913 .495614 .261276 .347952
.085406 .711806 .629163 .747946
A KSTEST for the 9 p-values yields .219359
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 tetris.32
For a sample of 1,000,000 consecutive 5-tuples,
chisquare for 99 degrees of freedom= 93.151; p-value= .353185
OPERM5 test for file tetris.32
For a sample of 1,000,000 consecutive 5-tuples,
chisquare for 99 degrees of freedom= 87.818; p-value= .217913
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 tetris.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 198 211.4 .851598 .852
29 5053 5134.0 1.278272 2.130
30 23260 23103.0 1.066279 3.196
31 11489 11551.5 .338423 3.535
chisquare= 3.535 for 3 d. of f.; p-value= .713745
--------------------------------------------------------------
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 tetris.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 213 211.4 .011838 .012
30 5038 5134.0 1.795471 1.807
31 23170 23103.0 .194032 2.001
32 11579 11551.5 .065351 2.067
chisquare= 2.067 for 3 d. of f.; p-value= .516594
--------------------------------------------------------------
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 tetris.32
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 1 to 8
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 892 944.3 2.897 2.897
r =5 21597 21743.9 .992 3.889
r =6 77511 77311.8 .513 4.402
p=1-exp(-SUM/2)= .88933
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 2 to 9
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 904 944.3 1.720 1.720
r =5 21648 21743.9 .423 2.143
r =6 77448 77311.8 .240 2.383
p=1-exp(-SUM/2)= .69622
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 3 to 10
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 950 944.3 .034 .034
r =5 21577 21743.9 1.281 1.315
r =6 77473 77311.8 .336 1.652
p=1-exp(-SUM/2)= .56211
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 4 to 11
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 934 944.3 .112 .112
r =5 21828 21743.9 .325 .438
r =6 77238 77311.8 .070 .508
p=1-exp(-SUM/2)= .22435
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 5 to 12
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 955 944.3 .121 .121
r =5 21778 21743.9 .053 .175
r =6 77267 77311.8 .026 .201
p=1-exp(-SUM/2)= .09546
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 6 to 13
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 894 944.3 2.679 2.679
r =5 21820 21743.9 .266 2.946
r =6 77286 77311.8 .009 2.954
p=1-exp(-SUM/2)= .77172
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 7 to 14
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 954 944.3 .100 .100
r =5 21675 21743.9 .218 .318
r =6 77371 77311.8 .045 .363
p=1-exp(-SUM/2)= .16609
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 8 to 15
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 957 944.3 .171 .171
r =5 21759 21743.9 .010 .181
r =6 77284 77311.8 .010 .191
p=1-exp(-SUM/2)= .09120
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 9 to 16
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 975 944.3 .998 .998
r =5 21911 21743.9 1.284 2.282
r =6 77114 77311.8 .506 2.788
p=1-exp(-SUM/2)= .75195
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 10 to 17
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 999 944.3 3.168 3.168
r =5 21765 21743.9 .020 3.189
r =6 77236 77311.8 .074 3.263
p=1-exp(-SUM/2)= .80439
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 11 to 18
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 953 944.3 .080 .080
r =5 21791 21743.9 .102 .182
r =6 77256 77311.8 .040 .222
p=1-exp(-SUM/2)= .10526
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 12 to 19
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 957 944.3 .171 .171
r =5 21641 21743.9 .487 .658
r =6 77402 77311.8 .105 .763
p=1-exp(-SUM/2)= .31715
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 13 to 20
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 954 944.3 .100 .100
r =5 21656 21743.9 .355 .455
r =6 77390 77311.8 .079 .534
p=1-exp(-SUM/2)= .23434
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 14 to 21
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 938 944.3 .042 .042
r =5 21933 21743.9 1.645 1.687
r =6 77129 77311.8 .432 2.119
p=1-exp(-SUM/2)= .65334
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 15 to 22
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 940 944.3 .020 .020
r =5 21877 21743.9 .815 .834
r =6 77183 77311.8 .215 1.049
p=1-exp(-SUM/2)= .40813
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 16 to 23
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 939 944.3 .030 .030
r =5 21819 21743.9 .259 .289
r =6 77242 77311.8 .063 .352
p=1-exp(-SUM/2)= .16145
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 17 to 24
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 936 944.3 .073 .073
r =5 21759 21743.9 .010 .083
r =6 77305 77311.8 .001 .084
p=1-exp(-SUM/2)= .04116
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 18 to 25
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 977 944.3 1.132 1.132
r =5 21587 21743.9 1.132 2.264
r =6 77436 77311.8 .200 2.464
p=1-exp(-SUM/2)= .70828
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 19 to 26
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 896 944.3 2.471 2.471
r =5 21892 21743.9 1.009 3.479
r =6 77212 77311.8 .129 3.608
p=1-exp(-SUM/2)= .83538
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 20 to 27
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 966 944.3 .499 .499
r =5 21664 21743.9 .294 .792
r =6 77370 77311.8 .044 .836
p=1-exp(-SUM/2)= .34164
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 21 to 28
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 886 944.3 3.600 3.600
r =5 21746 21743.9 .000 3.600
r =6 77368 77311.8 .041 3.641
p=1-exp(-SUM/2)= .83802
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 22 to 29
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 925 944.3 .395 .395
r =5 21757 21743.9 .008 .402
r =6 77318 77311.8 .000 .403
p=1-exp(-SUM/2)= .18246
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 23 to 30
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 934 944.3 .112 .112
r =5 21652 21743.9 .388 .501
r =6 77414 77311.8 .135 .636
p=1-exp(-SUM/2)= .27235
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 24 to 31
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 1005 944.3 3.902 3.902
r =5 21609 21743.9 .837 4.739
r =6 77386 77311.8 .071 4.810
p=1-exp(-SUM/2)= .90972
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG tetris.32
b-rank test for bits 25 to 32
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 1004 944.3 3.774 3.774
r =5 21763 21743.9 .017 3.791
r =6 77233 77311.8 .080 3.871
p=1-exp(-SUM/2)= .85567
TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices
These should be 25 uniform [0,1] random variables:
.889332 .696217 .562108 .224350 .095459
.771725 .166092 .091197 .751948 .804387
.105256 .317150 .234343 .653341 .408125
.161453 .041159 .708284 .835376 .341643
.838021 .182456 .272353 .909725 .855666
brank test summary for tetris.32
The KS test for those 25 supposed UNI's yields
KS p-value= .390822
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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: 141453 missing words, -1.07 sigmas from mean, p-value= .14317
tst no 2: 142456 missing words, 1.28 sigmas from mean, p-value= .89925
tst no 3: 142305 missing words, .92 sigmas from mean, p-value= .82238
tst no 4: 141557 missing words, -.82 sigmas from mean, p-value= .20520
tst no 5: 141402 missing words, -1.19 sigmas from mean, p-value= .11794
tst no 6: 141749 missing words, -.37 sigmas from mean, p-value= .35398
tst no 7: 142175 missing words, .62 sigmas from mean, p-value= .73261
tst no 8: 141877 missing words, -.08 sigmas from mean, p-value= .46990
tst no 9: 141085 missing words, -1.93 sigmas from mean, p-value= .02705
tst no 10: 141751 missing words, -.37 sigmas from mean, p-value= .35572
tst no 11: 141317 missing words, -1.38 sigmas from mean, p-value= .08319
tst no 12: 141780 missing words, -.30 sigmas from mean, p-value= .38126
tst no 13: 141915 missing words, .01 sigmas from mean, p-value= .50529
tst no 14: 142210 missing words, .70 sigmas from mean, p-value= .75882
tst no 15: 141548 missing words, -.84 sigmas from mean, p-value= .19927
tst no 16: 142186 missing words, .65 sigmas from mean, p-value= .74100
tst no 17: 141181 missing words, -1.70 sigmas from mean, p-value= .04441
tst no 18: 140968 missing words, -2.20 sigmas from mean, p-value= .01393
tst no 19: 142689 missing words, 1.82 sigmas from mean, p-value= .96575
tst no 20: 141406 missing words, -1.18 sigmas from mean, p-value= .11980
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 tetris.32
Output: No. missing words (mw), equiv normal variate (z), p-value (p)
mw z p
OPSO for tetris.32 using bits 23 to 32 141929 .068 .5270
OPSO for tetris.32 using bits 22 to 31 142293 1.323 .9071
OPSO for tetris.32 using bits 21 to 30 141848 -.211 .4163
OPSO for tetris.32 using bits 20 to 29 141673 -.815 .2076
OPSO for tetris.32 using bits 19 to 28 142164 .878 .8101
OPSO for tetris.32 using bits 18 to 27 142254 1.189 .8827
OPSO for tetris.32 using bits 17 to 26 141776 -.460 .3228
OPSO for tetris.32 using bits 16 to 25 141881 -.098 .4611
OPSO for tetris.32 using bits 15 to 24 141586 -1.115 .1324
OPSO for tetris.32 using bits 14 to 23 141698 -.729 .2331
OPSO for tetris.32 using bits 13 to 22 142394 1.671 .9527
OPSO for tetris.32 using bits 12 to 21 142304 1.361 .9132
OPSO for tetris.32 using bits 11 to 20 141809 -.346 .3647
OPSO for tetris.32 using bits 10 to 19 142056 .506 .6935
OPSO for tetris.32 using bits 9 to 18 141867 -.146 .4420
OPSO for tetris.32 using bits 8 to 17 141912 .009 .5037
OPSO for tetris.32 using bits 7 to 16 141996 .299 .6175
OPSO for tetris.32 using bits 6 to 15 141547 -1.249 .1058
OPSO for tetris.32 using bits 5 to 14 142064 .533 .7031
OPSO for tetris.32 using bits 4 to 13 142449 1.861 .9686
OPSO for tetris.32 using bits 3 to 12 141902 -.025 .4899
OPSO for tetris.32 using bits 2 to 11 142609 2.413 .9921
OPSO for tetris.32 using bits 1 to 10 141764 -.501 .3081
OQSO test for generator tetris.32
Output: No. missing words (mw), equiv normal variate (z), p-value (p)
mw z p
OQSO for tetris.32 using bits 28 to 32 141546 -1.232 .1090
OQSO for tetris.32 using bits 27 to 31 141918 .029 .5117
OQSO for tetris.32 using bits 26 to 30 141854 -.188 .4256
OQSO for tetris.32 using bits 25 to 29 142195 .968 .8336
OQSO for tetris.32 using bits 24 to 28 141793 -.394 .3467
OQSO for tetris.32 using bits 23 to 27 141237 -2.279 .0113
OQSO for tetris.32 using bits 22 to 26 141785 -.421 .3367
OQSO for tetris.32 using bits 21 to 25 142162 .857 .8041
OQSO for tetris.32 using bits 20 to 24 141453 -1.547 .0609
OQSO for tetris.32 using bits 19 to 23 141791 -.401 .3442
OQSO for tetris.32 using bits 18 to 22 141594 -1.069 .1426
OQSO for tetris.32 using bits 17 to 21 142029 .406 .6575
OQSO for tetris.32 using bits 16 to 20 141671 -.808 .2096
OQSO for tetris.32 using bits 15 to 19 141736 -.588 .2784
OQSO for tetris.32 using bits 14 to 18 141960 .172 .5682
OQSO for tetris.32 using bits 13 to 17 142092 .619 .7321
OQSO for tetris.32 using bits 12 to 16 141527 -1.296 .0975
OQSO for tetris.32 using bits 11 to 15 142387 1.619 .9473
OQSO for tetris.32 using bits 10 to 14 142139 .779 .7819
OQSO for tetris.32 using bits 9 to 13 141752 -.533 .2969
OQSO for tetris.32 using bits 8 to 12 141679 -.781 .2175
OQSO for tetris.32 using bits 7 to 11 142105 .663 .7464
OQSO for tetris.32 using bits 6 to 10 142029 .406 .6575
OQSO for tetris.32 using bits 5 to 9 142297 1.314 .9056
OQSO for tetris.32 using bits 4 to 8 142099 .643 .7399
OQSO for tetris.32 using bits 3 to 7 141764 -.493 .3111
OQSO for tetris.32 using bits 2 to 6 141554 -1.205 .1142
OQSO for tetris.32 using bits 1 to 5 141633 -.937 .1745
DNA test for generator tetris.32
Output: No. missing words (mw), equiv normal variate (z), p-value (p)
mw z p
DNA for tetris.32 using bits 31 to 32 141817 -.272 .3927
DNA for tetris.32 using bits 30 to 31 141921 .034 .5137
DNA for tetris.32 using bits 29 to 30 141888 -.063 .4749
DNA for tetris.32 using bits 28 to 29 141903 -.019 .4926
DNA for tetris.32 using bits 27 to 28 142037 .377 .6468
DNA for tetris.32 using bits 26 to 27 141602 -.907 .1823
DNA for tetris.32 using bits 25 to 26 142184 .810 .7911
DNA for tetris.32 using bits 24 to 25 142929 3.008 .9987
DNA for tetris.32 using bits 23 to 24 141644 -.783 .2169
DNA for tetris.32 using bits 22 to 23 142072 .480 .6843
DNA for tetris.32 using bits 21 to 22 142154 .722 .7648
DNA for tetris.32 using bits 20 to 21 141989 .235 .5929
DNA for tetris.32 using bits 19 to 20 142013 .306 .6201
DNA for tetris.32 using bits 18 to 19 141590 -.942 .1731
DNA for tetris.32 using bits 17 to 18 141869 -.119 .4527
DNA for tetris.32 using bits 16 to 17 142849 2.772 .9972
DNA for tetris.32 using bits 15 to 16 141596 -.924 .1777
DNA for tetris.32 using bits 14 to 15 142818 2.680 .9963
DNA for tetris.32 using bits 13 to 14 142247 .996 .8404
DNA for tetris.32 using bits 12 to 13 141909 -.001 .4996
DNA for tetris.32 using bits 11 to 12 142250 1.005 .8425
DNA for tetris.32 using bits 10 to 11 142179 .795 .7868
DNA for tetris.32 using bits 9 to 10 141622 -.848 .1983
DNA for tetris.32 using bits 8 to 9 142379 1.385 .9170
DNA for tetris.32 using bits 7 to 8 141956 .138 .5548
DNA for tetris.32 using bits 6 to 7 141452 -1.349 .0887
DNA for tetris.32 using bits 5 to 6 141683 -.668 .2522
DNA for tetris.32 using bits 4 to 5 141364 -1.609 .0538
DNA for tetris.32 using bits 3 to 4 142118 .616 .7309
DNA for tetris.32 using bits 2 to 3 141326 -1.721 .0426
DNA for tetris.32 using bits 1 to 2 141801 -.320 .3747
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 tetris.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 tetris.32 2789.84 4.099 .999979
byte stream for tetris.32 2826.95 4.624 .999998
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 2546.39 .656 .744102
bits 2 to 9 2510.22 .145 .557485
bits 3 to 10 2566.53 .941 .826618
bits 4 to 11 2532.80 .464 .678635
bits 5 to 12 2540.27 .569 .715486
bits 6 to 13 2488.06 -.169 .432953
bits 7 to 14 2647.54 2.087 .981537
bits 8 to 15 2457.42 -.602 .273520
bits 9 to 16 2435.13 -.917 .179466
bits 10 to 17 2536.21 .512 .695702
bits 11 to 18 2452.74 -.668 .251933
bits 12 to 19 2466.81 -.469 .319376
bits 13 to 20 2500.65 .009 .503661
bits 14 to 21 2584.77 1.199 .884708
bits 15 to 22 2613.60 1.607 .945920
bits 16 to 23 2573.47 1.039 .850600
bits 17 to 24 2403.09 -1.371 .085259
bits 18 to 25 2524.95 .353 .637914
bits 19 to 26 2481.29 -.265 .395649
bits 20 to 27 2447.00 -.750 .226756
bits 21 to 28 2432.18 -.959 .168746
bits 22 to 29 2340.23 -2.260 .011925
bits 23 to 30 2548.68 .688 .754396
bits 24 to 31 2504.91 .069 .527655
bits 25 to 32 2469.72 -.428 .334262
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 tetris.32
Of 12,000 tries, the average no. of successes
should be 3523 with sigma=21.9
Successes: 3529 z-score: .274 p-value: .607947
Successes: 3499 z-score: -1.096 p-value: .136563
Successes: 3542 z-score: .868 p-value: .807188
Successes: 3512 z-score: -.502 p-value: .307734
Successes: 3525 z-score: .091 p-value: .536382
Successes: 3546 z-score: 1.050 p-value: .853193
Successes: 3510 z-score: -.594 p-value: .276387
Successes: 3568 z-score: 2.055 p-value: .980051
Successes: 3545 z-score: 1.005 p-value: .842447
Successes: 3505 z-score: -.822 p-value: .205562
square size avg. no. parked sample sigma
100. 3528.100 20.900
KSTEST for the above 10: p= .210793
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 tetris.32
Sample no. d^2 avg equiv uni
5 1.5640 1.7972 .792341
10 1.1610 1.4524 .688644
15 .1279 1.2154 .120652
20 .1622 1.1682 .150392
25 1.2287 1.1472 .709119
30 .0844 1.0661 .081289
35 1.8159 1.0043 .838783
40 .6441 .9800 .476552
45 .4647 .9759 .373148
50 .4496 .9742 .363572
55 .6022 1.0472 .454072
60 2.9051 1.0503 .946051
65 .1139 1.0801 .108153
70 .0338 1.0505 .033368
75 .2317 1.0197 .207750
80 .6231 .9913 .465372
85 1.0093 .9920 .637362
90 .9378 .9589 .610351
95 5.5466 .9980 .996206
100 1.1842 .9908 .695829
MINIMUM DISTANCE TEST for tetris.32
Result of KS test on 20 transformed mindist^2's:
p-value= .387938
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 tetris.32
sample no: 1 r^3= 2.015 p-value= .06497
sample no: 2 r^3= 6.126 p-value= .18470
sample no: 3 r^3= 130.148 p-value= .98694
sample no: 4 r^3= 5.304 p-value= .16205
sample no: 5 r^3= 58.352 p-value= .85702
sample no: 6 r^3= 7.614 p-value= .22416
sample no: 7 r^3= 17.339 p-value= .43896
sample no: 8 r^3= 22.463 p-value= .52705
sample no: 9 r^3= 47.913 p-value= .79752
sample no: 10 r^3= 9.438 p-value= .26993
sample no: 11 r^3= 46.228 p-value= .78582
sample no: 12 r^3= .428 p-value= .01417
sample no: 13 r^3= 11.128 p-value= .30992
sample no: 14 r^3= 24.397 p-value= .55658
sample no: 15 r^3= 13.163 p-value= .35517
sample no: 16 r^3= 83.661 p-value= .93850
sample no: 17 r^3= 5.756 p-value= .17458
sample no: 18 r^3= 75.235 p-value= .91855
sample no: 19 r^3= 47.893 p-value= .79738
sample no: 20 r^3= 44.970 p-value= .77664
A KS test is applied to those 20 p-values.
---------------------------------------------------------
3DSPHERES test for file tetris.32 p-value= .157974
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 tetris.32
Table of standardized frequency counts
( (obs-exp)/sqrt(exp) )^2
for j taking values <=6,7,8,...,47,>=48:
-.8 .1 -1.1 -.5 .5 -.9
-1.3 .4 1.3 -.4 -.7 1.6
-1.4 -.8 1.6 -.9 -1.2 .1
-.7 .0 .4 1.2 .5 .4
-.2 .4 .0 -1.0 1.8 .0
.8 1.0 -1.1 .5 .9 -.3
1.0 -.7 .1 -1.3 .9 -1.0
1.8
Chi-square with 42 degrees of freedom: 35.683
z-score= -.689 p-value= .256451
______________________________________________________________
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 .308546
Test no. 2 p-value .390783
Test no. 3 p-value .425511
Test no. 4 p-value .529761
Test no. 5 p-value .793372
Test no. 6 p-value .453160
Test no. 7 p-value .363355
Test no. 8 p-value .353380
Test no. 9 p-value .557032
Test no. 10 p-value .951610
Results of the OSUM test for tetris.32
KSTEST on the above 10 p-values: .669235
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 tetris.32
Up and down runs in a sample of 10000
_________________________________________________
Run test for tetris.32 :
runs up; ks test for 10 p's: .277231
runs down; ks test for 10 p's: .089944
Run test for tetris.32 :
runs up; ks test for 10 p's: .125164
runs down; ks test for 10 p's: .807542
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 tetris.32
No. of wins: Observed Expected
98877 98585.86
98877= No. of wins, z-score= 1.302 pvalue= .90357
Analysis of Throws-per-Game:
Chisq= 24.03 for 20 degrees of freedom, p= .75881
Throws Observed Expected Chisq Sum
1 67111 66666.7 2.961 2.961
2 37636 37654.3 .009 2.970
3 26766 26954.7 1.321 4.292
4 19125 19313.5 1.839 6.131
5 13751 13851.4 .728 6.859
6 9986 9943.5 .181 7.040
7 7093 7145.0 .379 7.419
8 5050 5139.1 1.544 8.963
9 3671 3699.9 .225 9.188
10 2776 2666.3 4.514 13.702
11 1951 1923.3 .398 14.100
12 1369 1388.7 .281 14.380
13 1071 1003.7 4.511 18.891
14 726 726.1 .000 18.891
15 546 525.8 .773 19.664
16 388 381.2 .123 19.787
17 276 276.5 .001 19.788
18 179 200.8 2.373 22.161
19 140 146.0 .245 22.406
20 94 106.2 1.405 23.811
21 295 287.1 .217 24.028
SUMMARY FOR tetris.32
p-value for no. of wins: .903568
p-value for throws/game: .758815
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Results of DIEHARD battery of tests sent to file tetris.out