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 data.txt
For a sample of size 500: mean
data.txt using bits 1 to 24 1.964
duplicate number number
spacings observed expected
0 70. 67.668
1 132. 135.335
2 142. 135.335
3 84. 90.224
4 52. 45.112
5 14. 18.045
6 to INF 6. 8.282
Chisquare with 6 d.o.f. = 3.51 p-value= .256985
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
data.txt using bits 2 to 25 2.052
duplicate number number
spacings observed expected
0 65. 67.668
1 128. 135.335
2 144. 135.335
3 87. 90.224
4 49. 45.112
5 14. 18.045
6 to INF 13. 8.282
Chisquare with 6 d.o.f. = 5.10 p-value= .469251
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
data.txt using bits 3 to 26 1.976
duplicate number number
spacings observed expected
0 68. 67.668
1 132. 135.335
2 137. 135.335
3 97. 90.224
4 44. 45.112
5 18. 18.045
6 to INF 4. 8.282
Chisquare with 6 d.o.f. = 2.85 p-value= .173130
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
data.txt using bits 4 to 27 2.064
duplicate number number
spacings observed expected
0 60. 67.668
1 129. 135.335
2 134. 135.335
3 102. 90.224
4 54. 45.112
5 16. 18.045
6 to INF 5. 8.282
Chisquare with 6 d.o.f. = 6.00 p-value= .576710
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
data.txt using bits 5 to 28 2.042
duplicate number number
spacings observed expected
0 70. 67.668
1 126. 135.335
2 142. 135.335
3 85. 90.224
4 45. 45.112
5 22. 18.045
6 to INF 10. 8.282
Chisquare with 6 d.o.f. = 2.58 p-value= .140439
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
data.txt using bits 6 to 29 2.066
duplicate number number
spacings observed expected
0 62. 67.668
1 136. 135.335
2 127. 135.335
3 100. 90.224
4 42. 45.112
5 25. 18.045
6 to INF 8. 8.282
Chisquare with 6 d.o.f. = 4.96 p-value= .450511
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
data.txt using bits 7 to 30 1.926
duplicate number number
spacings observed expected
0 68. 67.668
1 152. 135.335
2 127. 135.335
3 82. 90.224
4 47. 45.112
5 21. 18.045
6 to INF 3. 8.282
Chisquare with 6 d.o.f. = 7.25 p-value= .701493
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
data.txt using bits 8 to 31 2.024
duplicate number number
spacings observed expected
0 72. 67.668
1 134. 135.335
2 126. 135.335
3 90. 90.224
4 51. 45.112
5 19. 18.045
6 to INF 8. 8.282
Chisquare with 6 d.o.f. = 1.76 p-value= .059907
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
data.txt using bits 9 to 32 2.062
duplicate number number
spacings observed expected
0 68. 67.668
1 132. 135.335
2 130. 135.335
3 86. 90.224
4 51. 45.112
5 22. 18.045
6 to INF 11. 8.282
Chisquare with 6 d.o.f. = 3.02 p-value= .193612
:::::::::::::::::::::::::::::::::::::::::
The 9 p-values were
.256985 .469251 .173130 .576710 .140439
.450511 .701493 .059907 .193612
A KSTEST for the 9 p-values yields .860231
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 data.txt
For a sample of 1,000,000 consecutive 5-tuples,
chisquare for 99 degrees of freedom=110.329; p-value= .794921
OPERM5 test for file data.txt
For a sample of 1,000,000 consecutive 5-tuples,
chisquare for 99 degrees of freedom=102.959; p-value= .627430
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 data.txt
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 201 211.4 .513367 .513
29 5114 5134.0 .077992 .591
30 23269 23103.0 1.192070 1.783
31 11416 11551.5 1.589995 3.373
chisquare= 3.373 for 3 d. of f.; p-value= .695575
--------------------------------------------------------------
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 data.txt
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 204 211.4 .260276 .260
30 5074 5134.0 .701446 .962
31 23113 23103.0 .004288 .966
32 11609 11551.5 .285975 1.252
chisquare= 1.252 for 3 d. of f.; p-value= .391022
--------------------------------------------------------------
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 data.txt
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 1 to 8
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 921 944.3 .575 .575
r =5 21638 21743.9 .516 1.091
r =6 77441 77311.8 .216 1.307
p=1-exp(-SUM/2)= .47969
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 2 to 9
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 969 944.3 .646 .646
r =5 21553 21743.9 1.676 2.322
r =6 77478 77311.8 .357 2.679
p=1-exp(-SUM/2)= .73806
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 3 to 10
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 968 944.3 .595 .595
r =5 21529 21743.9 2.124 2.719
r =6 77503 77311.8 .473 3.192
p=1-exp(-SUM/2)= .79724
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 4 to 11
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 922 944.3 .527 .527
r =5 21743 21743.9 .000 .527
r =6 77335 77311.8 .007 .534
p=1-exp(-SUM/2)= .23420
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 5 to 12
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 997 944.3 2.941 2.941
r =5 21687 21743.9 .149 3.090
r =6 77316 77311.8 .000 3.090
p=1-exp(-SUM/2)= .78670
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 6 to 13
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 939 944.3 .030 .030
r =5 21669 21743.9 .258 .288
r =6 77392 77311.8 .083 .371
p=1-exp(-SUM/2)= .16929
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 7 to 14
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 897 944.3 2.369 2.369
r =5 21736 21743.9 .003 2.372
r =6 77367 77311.8 .039 2.412
p=1-exp(-SUM/2)= .70056
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 8 to 15
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 964 944.3 .411 .411
r =5 21771 21743.9 .034 .445
r =6 77265 77311.8 .028 .473
p=1-exp(-SUM/2)= .21063
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 9 to 16
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 980 944.3 1.350 1.350
r =5 21770 21743.9 .031 1.381
r =6 77250 77311.8 .049 1.430
p=1-exp(-SUM/2)= .51088
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 10 to 17
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 955 944.3 .121 .121
r =5 21829 21743.9 .333 .454
r =6 77216 77311.8 .119 .573
p=1-exp(-SUM/2)= .24911
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 11 to 18
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 997 944.3 2.941 2.941
r =5 21670 21743.9 .251 3.192
r =6 77333 77311.8 .006 3.198
p=1-exp(-SUM/2)= .79790
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 12 to 19
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 964 944.3 .411 .411
r =5 21847 21743.9 .489 .900
r =6 77189 77311.8 .195 1.095
p=1-exp(-SUM/2)= .42156
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 13 to 20
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 981 944.3 1.426 1.426
r =5 21890 21743.9 .982 2.408
r =6 77129 77311.8 .432 2.840
p=1-exp(-SUM/2)= .75830
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 14 to 21
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 986 944.3 1.841 1.841
r =5 21709 21743.9 .056 1.897
r =6 77305 77311.8 .001 1.898
p=1-exp(-SUM/2)= .61286
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 15 to 22
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 938 944.3 .042 .042
r =5 21711 21743.9 .050 .092
r =6 77351 77311.8 .020 .112
p=1-exp(-SUM/2)= .05432
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 16 to 23
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 997 944.3 2.941 2.941
r =5 21623 21743.9 .672 3.613
r =6 77380 77311.8 .060 3.673
p=1-exp(-SUM/2)= .84065
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 17 to 24
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 902 944.3 1.895 1.895
r =5 21755 21743.9 .006 1.901
r =6 77343 77311.8 .013 1.913
p=1-exp(-SUM/2)= .61580
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 18 to 25
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 928 944.3 .281 .281
r =5 21568 21743.9 1.423 1.704
r =6 77504 77311.8 .478 2.182
p=1-exp(-SUM/2)= .66415
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 19 to 26
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 911 944.3 1.174 1.174
r =5 21680 21743.9 .188 1.362
r =6 77409 77311.8 .122 1.484
p=1-exp(-SUM/2)= .52393
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 20 to 27
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 955 944.3 .121 .121
r =5 21584 21743.9 1.176 1.297
r =6 77461 77311.8 .288 1.585
p=1-exp(-SUM/2)= .54729
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 21 to 28
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 940 944.3 .020 .020
r =5 21688 21743.9 .144 .163
r =6 77372 77311.8 .047 .210
p=1-exp(-SUM/2)= .09975
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 22 to 29
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 995 944.3 2.722 2.722
r =5 21678 21743.9 .200 2.922
r =6 77327 77311.8 .003 2.925
p=1-exp(-SUM/2)= .76831
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 23 to 30
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 956 944.3 .145 .145
r =5 21683 21743.9 .171 .316
r =6 77361 77311.8 .031 .347
p=1-exp(-SUM/2)= .15920
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 24 to 31
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 996 944.3 2.830 2.830
r =5 21912 21743.9 1.300 4.130
r =6 77092 77311.8 .625 4.755
p=1-exp(-SUM/2)= .90721
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG data.txt
b-rank test for bits 25 to 32
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 960 944.3 .261 .261
r =5 21947 21743.9 1.897 2.158
r =6 77093 77311.8 .619 2.777
p=1-exp(-SUM/2)= .75059
TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices
These should be 25 uniform [0,1] random variables:
.479686 .738061 .797244 .234204 .786698
.169292 .700556 .210629 .510882 .249110
.797895 .421562 .758303 .612864 .054319
.840653 .615802 .664148 .523927 .547290
.099753 .768307 .159202 .907213 .750588
brank test summary for data.txt
The KS test for those 25 supposed UNI's yields
KS p-value= .579773
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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: 142257 missing words, .81 sigmas from mean, p-value= .79170
tst no 2: 141843 missing words, -.15 sigmas from mean, p-value= .43842
tst no 3: 142125 missing words, .50 sigmas from mean, p-value= .69284
tst no 4: 141300 missing words, -1.42 sigmas from mean, p-value= .07727
tst no 5: 142120 missing words, .49 sigmas from mean, p-value= .68872
tst no 6: 142012 missing words, .24 sigmas from mean, p-value= .59479
tst no 7: 142062 missing words, .36 sigmas from mean, p-value= .63935
tst no 8: 140718 missing words, -2.78 sigmas from mean, p-value= .00269
tst no 9: 141439 missing words, -1.10 sigmas from mean, p-value= .13591
tst no 10: 141423 missing words, -1.14 sigmas from mean, p-value= .12792
tst no 11: 142110 missing words, .47 sigmas from mean, p-value= .68041
tst no 12: 141940 missing words, .07 sigmas from mean, p-value= .52857
tst no 13: 141879 missing words, -.07 sigmas from mean, p-value= .47175
tst no 14: 142012 missing words, .24 sigmas from mean, p-value= .59479
tst no 15: 141451 missing words, -1.07 sigmas from mean, p-value= .14212
tst no 16: 141744 missing words, -.39 sigmas from mean, p-value= .34964
tst no 17: 140999 missing words, -2.13 sigmas from mean, p-value= .01671
tst no 18: 141282 missing words, -1.47 sigmas from mean, p-value= .07136
tst no 19: 141771 missing words, -.32 sigmas from mean, p-value= .37327
tst no 20: 142183 missing words, .64 sigmas from mean, p-value= .73873
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 data.txt
Output: No. missing words (mw), equiv normal variate (z), p-value (p)
mw z p
OPSO for data.txt using bits 23 to 32 142207 1.026 .8477
OPSO for data.txt using bits 22 to 31 142170 .899 .8156
OPSO for data.txt using bits 21 to 30 142143 .806 .7898
OPSO for data.txt using bits 20 to 29 141822 -.301 .3817
OPSO for data.txt using bits 19 to 28 142064 .533 .7031
OPSO for data.txt using bits 18 to 27 141824 -.294 .3843
OPSO for data.txt using bits 17 to 26 142152 .837 .7986
OPSO for data.txt using bits 16 to 25 141822 -.301 .3817
OPSO for data.txt using bits 15 to 24 142103 .668 .7479
OPSO for data.txt using bits 14 to 23 141963 .185 .5734
OPSO for data.txt using bits 13 to 22 141561 -1.201 .1149
OPSO for data.txt using bits 12 to 21 141972 .216 .5855
OPSO for data.txt using bits 11 to 20 141988 .271 .6069
OPSO for data.txt using bits 10 to 19 142138 .789 .7848
OPSO for data.txt using bits 9 to 18 141622 -.991 .1609
OPSO for data.txt using bits 8 to 17 141519 -1.346 .0892
OPSO for data.txt using bits 7 to 16 142303 1.357 .9127
OPSO for data.txt using bits 6 to 15 141543 -1.263 .1033
OPSO for data.txt using bits 5 to 14 141776 -.460 .3228
OPSO for data.txt using bits 4 to 13 141631 -.960 .1686
OPSO for data.txt using bits 3 to 12 141450 -1.584 .0566
OPSO for data.txt using bits 2 to 11 141686 -.770 .2206
OPSO for data.txt using bits 1 to 10 141277 -2.180 .0146
OQSO test for generator data.txt
Output: No. missing words (mw), equiv normal variate (z), p-value (p)
mw z p
OQSO for data.txt using bits 28 to 32 142207 1.009 .8435
OQSO for data.txt using bits 27 to 31 141682 -.771 .2205
OQSO for data.txt using bits 26 to 30 141975 .223 .5881
OQSO for data.txt using bits 25 to 29 142047 .467 .6796
OQSO for data.txt using bits 24 to 28 141884 -.086 .4658
OQSO for data.txt using bits 23 to 27 141433 -1.615 .0532
OQSO for data.txt using bits 22 to 26 142298 1.318 .9062
OQSO for data.txt using bits 21 to 25 141604 -1.035 .1503
OQSO for data.txt using bits 20 to 24 142581 2.277 .9886
OQSO for data.txt using bits 19 to 23 141796 -.384 .3504
OQSO for data.txt using bits 18 to 22 141650 -.879 .1897
OQSO for data.txt using bits 17 to 21 141889 -.069 .4725
OQSO for data.txt using bits 16 to 20 141904 -.018 .4928
OQSO for data.txt using bits 15 to 19 142149 .812 .7917
OQSO for data.txt using bits 14 to 18 141716 -.655 .2561
OQSO for data.txt using bits 13 to 17 141818 -.310 .3784
OQSO for data.txt using bits 12 to 16 141980 .240 .5947
OQSO for data.txt using bits 11 to 15 141720 -.642 .2605
OQSO for data.txt using bits 10 to 14 142025 .392 .6525
OQSO for data.txt using bits 9 to 13 142126 .734 .7687
OQSO for data.txt using bits 8 to 12 142153 .826 .7956
OQSO for data.txt using bits 7 to 11 142256 1.175 .8800
OQSO for data.txt using bits 6 to 10 141621 -.977 .1642
OQSO for data.txt using bits 5 to 9 141484 -1.442 .0747
OQSO for data.txt using bits 4 to 8 142585 2.290 .9890
OQSO for data.txt using bits 3 to 7 141328 -1.971 .0244
OQSO for data.txt using bits 2 to 6 141962 .179 .5709
OQSO for data.txt using bits 1 to 5 142121 .718 .7635
DNA test for generator data.txt
Output: No. missing words (mw), equiv normal variate (z), p-value (p)
mw z p
DNA for data.txt using bits 31 to 32 143030 3.306 .9995
DNA for data.txt using bits 30 to 31 141920 .031 .5126
DNA for data.txt using bits 29 to 30 142008 .291 .6145
DNA for data.txt using bits 28 to 29 143039 3.332 .9996
DNA for data.txt using bits 27 to 28 142153 .719 .7639
DNA for data.txt using bits 26 to 27 142078 .498 .6906
DNA for data.txt using bits 25 to 26 141710 -.588 .2783
DNA for data.txt using bits 24 to 25 141915 .017 .5067
DNA for data.txt using bits 23 to 24 141280 -1.856 .0317
DNA for data.txt using bits 22 to 23 141705 -.603 .2733
DNA for data.txt using bits 21 to 22 142168 .763 .7773
DNA for data.txt using bits 20 to 21 141719 -.561 .2872
DNA for data.txt using bits 19 to 20 142099 .560 .7121
DNA for data.txt using bits 18 to 19 141676 -.688 .2456
DNA for data.txt using bits 17 to 18 142188 .822 .7945
DNA for data.txt using bits 16 to 17 142641 2.158 .9845
DNA for data.txt using bits 15 to 16 141174 -2.169 .0150
DNA for data.txt using bits 14 to 15 141854 -.163 .4352
DNA for data.txt using bits 13 to 14 141844 -.193 .4236
DNA for data.txt using bits 12 to 13 141723 -.550 .2913
DNA for data.txt using bits 11 to 12 141656 -.747 .2274
DNA for data.txt using bits 10 to 11 141829 -.237 .4063
DNA for data.txt using bits 9 to 10 141702 -.612 .2704
DNA for data.txt using bits 8 to 9 142276 1.082 .8603
DNA for data.txt using bits 7 to 8 141781 -.379 .3525
DNA for data.txt using bits 6 to 7 141499 -1.210 .1131
DNA for data.txt using bits 5 to 6 141404 -1.491 .0680
DNA for data.txt using bits 4 to 5 142029 .353 .6380
DNA for data.txt using bits 3 to 4 141734 -.517 .3025
DNA for data.txt using bits 2 to 3 141530 -1.119 .1316
DNA for data.txt using bits 1 to 2 142032 .362 .6413
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 data.txt
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 data.txt 2559.30 .839 .799142
byte stream for data.txt 2494.73 -.074 .470310
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 2487.47 -.177 .429682
bits 2 to 9 2430.02 -.990 .161161
bits 3 to 10 2366.24 -1.892 .029267
bits 4 to 11 2544.83 .634 .736937
bits 5 to 12 2478.97 -.297 .383084
bits 6 to 13 2606.53 1.506 .934030
bits 7 to 14 2396.89 -1.458 .072395
bits 8 to 15 2438.68 -.867 .192918
bits 9 to 16 2563.73 .901 .816274
bits 10 to 17 2418.92 -1.147 .125774
bits 11 to 18 2461.71 -.542 .294071
bits 12 to 19 2583.36 1.179 .880776
bits 13 to 20 2378.72 -1.715 .043164
bits 14 to 21 2518.29 .259 .602069
bits 15 to 22 2532.51 .460 .677142
bits 16 to 23 2568.23 .965 .832721
bits 17 to 24 2519.51 .276 .608707
bits 18 to 25 2579.38 1.123 .869186
bits 19 to 26 2568.26 .965 .832807
bits 20 to 27 2537.42 .529 .701667
bits 21 to 28 2458.66 -.585 .279403
bits 22 to 29 2643.15 2.024 .978540
bits 23 to 30 2491.25 -.124 .450743
bits 24 to 31 2532.04 .453 .674758
bits 25 to 32 2495.48 -.064 .474490
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 data.txt
Of 12,000 tries, the average no. of successes
should be 3523 with sigma=21.9
Successes: 3539 z-score: .731 p-value: .767486
Successes: 3565 z-score: 1.918 p-value: .972432
Successes: 3497 z-score: -1.187 p-value: .117571
Successes: 3523 z-score: .000 p-value: .500000
Successes: 3525 z-score: .091 p-value: .536382
Successes: 3535 z-score: .548 p-value: .708135
Successes: 3532 z-score: .411 p-value: .659449
Successes: 3517 z-score: -.274 p-value: .392053
Successes: 3499 z-score: -1.096 p-value: .136563
Successes: 3533 z-score: .457 p-value: .676028
square size avg. no. parked sample sigma
100. 3526.500 18.744
KSTEST for the above 10: p= .216668
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 data.txt
Sample no. d^2 avg equiv uni
5 .1067 .6313 .101717
10 .2075 .9050 .188264
15 .0256 .7512 .025447
20 2.3914 .8820 .909592
25 .3354 .8628 .286123
30 1.0764 .9570 .661026
35 1.3006 1.0329 .729395
40 2.8556 1.1036 .943298
45 .2084 1.0283 .188981
50 1.2425 .9882 .713131
55 .5131 1.0040 .402927
60 1.8918 1.0064 .850630
65 3.4570 1.0197 .969017
70 .3003 1.0513 .260531
75 2.1931 1.0814 .889653
80 2.5171 1.0716 .920324
85 1.4425 1.0582 .765368
90 .1767 1.0340 .162704
95 .5380 1.0306 .417649
100 .4978 1.0096 .393664
MINIMUM DISTANCE TEST for data.txt
Result of KS test on 20 transformed mindist^2's:
p-value= .025444
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 data.txt
sample no: 1 r^3= 67.193 p-value= .89352
sample no: 2 r^3= 6.174 p-value= .18599
sample no: 3 r^3= 5.602 p-value= .17034
sample no: 4 r^3= 27.928 p-value= .60581
sample no: 5 r^3= 16.265 p-value= .41852
sample no: 6 r^3= 79.862 p-value= .93020
sample no: 7 r^3= 3.500 p-value= .11011
sample no: 8 r^3= 8.302 p-value= .24175
sample no: 9 r^3= 32.219 p-value= .65835
sample no: 10 r^3= 2.164 p-value= .06960
sample no: 11 r^3= 11.041 p-value= .30790
sample no: 12 r^3= 30.049 p-value= .63272
sample no: 13 r^3= .481 p-value= .01590
sample no: 14 r^3= 20.672 p-value= .49795
sample no: 15 r^3= 20.035 p-value= .48719
sample no: 16 r^3= 19.143 p-value= .47170
sample no: 17 r^3= 55.204 p-value= .84121
sample no: 18 r^3= 30.251 p-value= .63519
sample no: 19 r^3= 50.961 p-value= .81708
sample no: 20 r^3= 1.043 p-value= .03416
A KS test is applied to those 20 p-values.
---------------------------------------------------------
3DSPHERES test for file data.txt p-value= .240003
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 data.txt
Table of standardized frequency counts
( (obs-exp)/sqrt(exp) )^2
for j taking values <=6,7,8,...,47,>=48:
-.8 -.3 .8 -.7 2.0 -1.7
.6 -2.2 -1.5 .5 1.2 -1.4
.0 1.0 .5 -.3 .2 .1
.3 .3 .1 -.2 -.9 -.3
-.1 -.3 1.4 -.1 -.1 -1.1
-.2 .5 1.5 1.0 -.1 .4
.0 -.1 -1.2 -.1 .1 1.0
-.1
Chi-square with 42 degrees of freedom: 32.090
z-score= -1.081 p-value= .134167
______________________________________________________________
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 .915488
Test no. 2 p-value .856182
Test no. 3 p-value .903568
Test no. 4 p-value .386940
Test no. 5 p-value .555228
Test no. 6 p-value .952627
Test no. 7 p-value .917217
Test no. 8 p-value .921442
Test no. 9 p-value .395145
Test no. 10 p-value .170341
Results of the OSUM test for data.txt
KSTEST on the above 10 p-values: .981562
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 data.txt
Up and down runs in a sample of 10000
_________________________________________________
Run test for data.txt :
runs up; ks test for 10 p's: .434626
runs down; ks test for 10 p's: .328503
Run test for data.txt :
runs up; ks test for 10 p's: .953026
runs down; ks test for 10 p's: .027564
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 data.txt
No. of wins: Observed Expected
98541 98585.86
98541= No. of wins, z-score= -.201 pvalue= .42049
Analysis of Throws-per-Game:
Chisq= 9.65 for 20 degrees of freedom, p= .02598
Throws Observed Expected Chisq Sum
1 66443 66666.7 .750 .750
2 37899 37654.3 1.590 2.340
3 26940 26954.7 .008 2.348
4 19224 19313.5 .414 2.763
5 13819 13851.4 .076 2.839
6 10021 9943.5 .603 3.442
7 7185 7145.0 .224 3.666
8 5098 5139.1 .328 3.994
9 3691 3699.9 .021 4.015
10 2735 2666.3 1.770 5.785
11 1912 1923.3 .067 5.852
12 1374 1388.7 .156 6.009
13 1012 1003.7 .068 6.077
14 707 726.1 .505 6.582
15 544 525.8 .627 7.209
16 398 381.2 .745 7.954
17 272 276.5 .075 8.028
18 199 200.8 .017 8.045
19 153 146.0 .337 8.382
20 96 106.2 .982 9.365
21 278 287.1 .289 9.654
SUMMARY FOR data.txt
p-value for no. of wins: .420491
p-value for throws/game: .025980
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Results of DIEHARD battery of tests sent to file output.txt