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 new.txt
For a sample of size 500: mean
new.txt using bits 1 to 24 1.992
duplicate number number
spacings observed expected
0 61. 67.668
1 143. 135.335
2 145. 135.335
3 74. 90.224
4 53. 45.112
5 17. 18.045
6 to INF 7. 8.282
Chisquare with 6 d.o.f. = 6.34 p-value= .613453
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
new.txt using bits 2 to 25 2.020
duplicate number number
spacings observed expected
0 68. 67.668
1 140. 135.335
2 128. 135.335
3 91. 90.224
4 39. 45.112
5 20. 18.045
6 to INF 14. 8.282
Chisquare with 6 d.o.f. = 5.55 p-value= .525131
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
new.txt using bits 3 to 26 1.982
duplicate number number
spacings observed expected
0 74. 67.668
1 130. 135.335
2 125. 135.335
3 100. 90.224
4 47. 45.112
5 21. 18.045
6 to INF 3. 8.282
Chisquare with 6 d.o.f. = 6.58 p-value= .638877
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
new.txt using bits 4 to 27 2.006
duplicate number number
spacings observed expected
0 70. 67.668
1 131. 135.335
2 142. 135.335
3 87. 90.224
4 39. 45.112
5 21. 18.045
6 to INF 10. 8.282
Chisquare with 6 d.o.f. = 2.33 p-value= .113134
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
new.txt using bits 5 to 28 1.936
duplicate number number
spacings observed expected
0 78. 67.668
1 128. 135.335
2 135. 135.335
3 101. 90.224
4 36. 45.112
5 14. 18.045
6 to INF 8. 8.282
Chisquare with 6 d.o.f. = 6.02 p-value= .579032
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
new.txt using bits 6 to 29 2.044
duplicate number number
spacings observed expected
0 65. 67.668
1 142. 135.335
2 132. 135.335
3 80. 90.224
4 44. 45.112
5 26. 18.045
6 to INF 11. 8.282
Chisquare with 6 d.o.f. = 6.10 p-value= .588006
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
new.txt using bits 7 to 30 1.924
duplicate number number
spacings observed expected
0 75. 67.668
1 148. 135.335
2 119. 135.335
3 93. 90.224
4 39. 45.112
5 19. 18.045
6 to INF 7. 8.282
Chisquare with 6 d.o.f. = 5.11 p-value= .470701
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
new.txt using bits 8 to 31 1.942
duplicate number number
spacings observed expected
0 67. 67.668
1 142. 135.335
2 134. 135.335
3 92. 90.224
4 47. 45.112
5 14. 18.045
6 to INF 4. 8.282
Chisquare with 6 d.o.f. = 3.58 p-value= .267018
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
new.txt using bits 9 to 32 2.098
duplicate number number
spacings observed expected
0 58. 67.668
1 128. 135.335
2 139. 135.335
3 101. 90.224
4 45. 45.112
5 18. 18.045
6 to INF 11. 8.282
Chisquare with 6 d.o.f. = 4.06 p-value= .331135
:::::::::::::::::::::::::::::::::::::::::
The 9 p-values were
.613453 .525131 .638877 .113134 .579032
.588006 .470701 .267018 .331135
A KSTEST for the 9 p-values yields .675361
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 new.txt
For a sample of 1,000,000 consecutive 5-tuples,
chisquare for 99 degrees of freedom= 97.144; p-value= .465993
OPERM5 test for file new.txt
For a sample of 1,000,000 consecutive 5-tuples,
chisquare for 99 degrees of freedom=116.218; p-value= .886127
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 new.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 203 211.4 .335179 .335
29 5191 5134.0 .632611 .968
30 23125 23103.0 .020860 .989
31 11481 11551.5 .430566 1.419
chisquare= 1.419 for 3 d. of f.; p-value= .415730
--------------------------------------------------------------
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 new.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 205 211.4 .194832 .195
30 5194 5134.0 .700967 .896
31 22899 23103.0 1.802149 2.698
32 11702 11551.5 1.960166 4.658
chisquare= 4.658 for 3 d. of f.; p-value= .816841
--------------------------------------------------------------
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 new.txt
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 1 to 8
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 956 944.3 .145 .145
r =5 21696 21743.9 .106 .250
r =6 77348 77311.8 .017 .267
p=1-exp(-SUM/2)= .12515
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 2 to 9
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 948 944.3 .014 .014
r =5 21838 21743.9 .407 .422
r =6 77214 77311.8 .124 .545
p=1-exp(-SUM/2)= .23870
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 3 to 10
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 954 944.3 .100 .100
r =5 21766 21743.9 .022 .122
r =6 77280 77311.8 .013 .135
p=1-exp(-SUM/2)= .06535
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 4 to 11
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 937 944.3 .056 .056
r =5 22033 21743.9 3.844 3.900
r =6 77030 77311.8 1.027 4.927
p=1-exp(-SUM/2)= .91488
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 5 to 12
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 935 944.3 .092 .092
r =5 22062 21743.9 4.654 4.745
r =6 77003 77311.8 1.233 5.979
p=1-exp(-SUM/2)= .94968
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 6 to 13
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 978 944.3 1.203 1.203
r =5 21666 21743.9 .279 1.482
r =6 77356 77311.8 .025 1.507
p=1-exp(-SUM/2)= .52927
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 7 to 14
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 1008 944.3 4.297 4.297
r =5 21569 21743.9 1.407 5.704
r =6 77423 77311.8 .160 5.864
p=1-exp(-SUM/2)= .94670
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 8 to 15
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 943 944.3 .002 .002
r =5 21914 21743.9 1.331 1.332
r =6 77143 77311.8 .369 1.701
p=1-exp(-SUM/2)= .57281
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 9 to 16
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 939 944.3 .030 .030
r =5 21664 21743.9 .294 .323
r =6 77397 77311.8 .094 .417
p=1-exp(-SUM/2)= .18830
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 10 to 17
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 983 944.3 1.586 1.586
r =5 21558 21743.9 1.589 3.175
r =6 77459 77311.8 .280 3.456
p=1-exp(-SUM/2)= .82232
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 11 to 18
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 914 944.3 .972 .972
r =5 21882 21743.9 .877 1.849
r =6 77204 77311.8 .150 2.000
p=1-exp(-SUM/2)= .63207
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 12 to 19
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 968 944.3 .595 .595
r =5 21860 21743.9 .620 1.215
r =6 77172 77311.8 .253 1.467
p=1-exp(-SUM/2)= .51989
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 13 to 20
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 930 944.3 .217 .217
r =5 21659 21743.9 .331 .548
r =6 77411 77311.8 .127 .675
p=1-exp(-SUM/2)= .28658
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 14 to 21
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 889 944.3 3.239 3.239
r =5 21635 21743.9 .545 3.784
r =6 77476 77311.8 .349 4.133
p=1-exp(-SUM/2)= .87336
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 15 to 22
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 871 944.3 5.690 5.690
r =5 21649 21743.9 .414 6.104
r =6 77480 77311.8 .366 6.470
p=1-exp(-SUM/2)= .96064
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 16 to 23
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 933 944.3 .135 .135
r =5 21623 21743.9 .672 .807
r =6 77444 77311.8 .226 1.034
p=1-exp(-SUM/2)= .40355
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 17 to 24
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 939 944.3 .030 .030
r =5 21792 21743.9 .106 .136
r =6 77269 77311.8 .024 .160
p=1-exp(-SUM/2)= .07682
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 18 to 25
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 952 944.3 .063 .063
r =5 21660 21743.9 .324 .387
r =6 77388 77311.8 .075 .462
p=1-exp(-SUM/2)= .20610
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 19 to 26
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 931 944.3 .187 .187
r =5 21740 21743.9 .001 .188
r =6 77329 77311.8 .004 .192
p=1-exp(-SUM/2)= .09148
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 20 to 27
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 921 944.3 .575 .575
r =5 21649 21743.9 .414 .989
r =6 77430 77311.8 .181 1.170
p=1-exp(-SUM/2)= .44286
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 21 to 28
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 908 944.3 1.396 1.396
r =5 21802 21743.9 .155 1.551
r =6 77290 77311.8 .006 1.557
p=1-exp(-SUM/2)= .54088
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 22 to 29
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 937 944.3 .056 .056
r =5 21762 21743.9 .015 .072
r =6 77301 77311.8 .002 .073
p=1-exp(-SUM/2)= .03586
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 23 to 30
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 898 944.3 2.270 2.270
r =5 21917 21743.9 1.378 3.648
r =6 77185 77311.8 .208 3.856
p=1-exp(-SUM/2)= .85458
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 24 to 31
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 919 944.3 .678 .678
r =5 21490 21743.9 2.965 3.643
r =6 77591 77311.8 1.008 4.651
p=1-exp(-SUM/2)= .90226
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG new.txt
b-rank test for bits 25 to 32
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 888 944.3 3.357 3.357
r =5 21619 21743.9 .717 4.074
r =6 77493 77311.8 .425 4.499
p=1-exp(-SUM/2)= .89454
TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices
These should be 25 uniform [0,1] random variables:
.125148 .238696 .065346 .914881 .949679
.529270 .946700 .572806 .188299 .822320
.632074 .519888 .286577 .873356 .960642
.403551 .076820 .206101 .091483 .442856
.540883 .035856 .854580 .902262 .894544
brank test summary for new.txt
The KS test for those 25 supposed UNI's yields
KS p-value= .567482
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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: 142049 missing words, .33 sigmas from mean, p-value= .62791
tst no 2: 142715 missing words, 1.88 sigmas from mean, p-value= .97011
tst no 3: 141234 missing words, -1.58 sigmas from mean, p-value= .05730
tst no 4: 142355 missing words, 1.04 sigmas from mean, p-value= .85113
tst no 5: 141903 missing words, -.01 sigmas from mean, p-value= .49410
tst no 6: 141825 missing words, -.20 sigmas from mean, p-value= .42190
tst no 7: 141750 missing words, -.37 sigmas from mean, p-value= .35485
tst no 8: 141672 missing words, -.55 sigmas from mean, p-value= .28962
tst no 9: 141551 missing words, -.84 sigmas from mean, p-value= .20124
tst no 10: 142184 missing words, .64 sigmas from mean, p-value= .73948
tst no 11: 142436 missing words, 1.23 sigmas from mean, p-value= .89075
tst no 12: 142008 missing words, .23 sigmas from mean, p-value= .59116
tst no 13: 141980 missing words, .17 sigmas from mean, p-value= .56558
tst no 14: 142547 missing words, 1.49 sigmas from mean, p-value= .93187
tst no 15: 141376 missing words, -1.25 sigmas from mean, p-value= .10636
tst no 16: 142344 missing words, 1.02 sigmas from mean, p-value= .84509
tst no 17: 141540 missing words, -.86 sigmas from mean, p-value= .19409
tst no 18: 142298 missing words, .91 sigmas from mean, p-value= .81809
tst no 19: 142024 missing words, .27 sigmas from mean, p-value= .60562
tst no 20: 141558 missing words, -.82 sigmas from mean, p-value= .20586
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 new.txt
Output: No. missing words (mw), equiv normal variate (z), p-value (p)
mw z p
OPSO for new.txt using bits 23 to 32 142237 1.130 .8707
OPSO for new.txt using bits 22 to 31 141950 .140 .5558
OPSO for new.txt using bits 21 to 30 141825 -.291 .3856
OPSO for new.txt using bits 20 to 29 142056 .506 .6935
OPSO for new.txt using bits 19 to 28 141689 -.760 .2237
OPSO for new.txt using bits 18 to 27 141595 -1.084 .1392
OPSO for new.txt using bits 17 to 26 141974 .223 .5882
OPSO for new.txt using bits 16 to 25 142059 .516 .6971
OPSO for new.txt using bits 15 to 24 141882 -.094 .4625
OPSO for new.txt using bits 14 to 23 142099 .654 .7435
OPSO for new.txt using bits 13 to 22 141862 -.163 .4352
OPSO for new.txt using bits 12 to 21 142307 1.371 .9149
OPSO for new.txt using bits 11 to 20 141361 -1.891 .0293
OPSO for new.txt using bits 10 to 19 141861 -.167 .4338
OPSO for new.txt using bits 9 to 18 142336 1.471 .9294
OPSO for new.txt using bits 8 to 17 142032 .423 .6639
OPSO for new.txt using bits 7 to 16 141934 .085 .5339
OPSO for new.txt using bits 6 to 15 141964 .189 .5748
OPSO for new.txt using bits 5 to 14 142102 .664 .7468
OPSO for new.txt using bits 4 to 13 142000 .313 .6227
OPSO for new.txt using bits 3 to 12 142171 .902 .8166
OPSO for new.txt using bits 2 to 11 141756 -.529 .2985
OPSO for new.txt using bits 1 to 10 141901 -.029 .4885
OQSO test for generator new.txt
Output: No. missing words (mw), equiv normal variate (z), p-value (p)
mw z p
OQSO for new.txt using bits 28 to 32 141935 .087 .5347
OQSO for new.txt using bits 27 to 31 141974 .219 .5868
OQSO for new.txt using bits 26 to 30 142243 1.131 .8710
OQSO for new.txt using bits 25 to 29 142016 .362 .6412
OQSO for new.txt using bits 24 to 28 142075 .562 .7128
OQSO for new.txt using bits 23 to 27 141820 -.303 .3810
OQSO for new.txt using bits 22 to 26 141770 -.472 .3184
OQSO for new.txt using bits 21 to 25 141610 -1.015 .1551
OQSO for new.txt using bits 20 to 24 141824 -.289 .3862
OQSO for new.txt using bits 19 to 23 141769 -.476 .3171
OQSO for new.txt using bits 18 to 22 142139 .779 .7819
OQSO for new.txt using bits 17 to 21 142113 .690 .7550
OQSO for new.txt using bits 16 to 20 141591 -1.079 .1403
OQSO for new.txt using bits 15 to 19 141767 -.482 .3147
OQSO for new.txt using bits 14 to 18 142044 .457 .6760
OQSO for new.txt using bits 13 to 17 141960 .172 .5682
OQSO for new.txt using bits 12 to 16 141998 .301 .6181
OQSO for new.txt using bits 11 to 15 141876 -.113 .4550
OQSO for new.txt using bits 10 to 14 141760 -.506 .3064
OQSO for new.txt using bits 9 to 13 141836 -.249 .4018
OQSO for new.txt using bits 8 to 12 142616 2.395 .9917
OQSO for new.txt using bits 7 to 11 141803 -.360 .3593
OQSO for new.txt using bits 6 to 10 142159 .846 .8013
OQSO for new.txt using bits 5 to 9 141691 -.740 .2296
OQSO for new.txt using bits 4 to 8 141761 -.503 .3075
OQSO for new.txt using bits 3 to 7 142353 1.504 .9337
OQSO for new.txt using bits 2 to 6 141883 -.089 .4644
OQSO for new.txt using bits 1 to 5 142005 .324 .6271
DNA test for generator new.txt
Output: No. missing words (mw), equiv normal variate (z), p-value (p)
mw z p
DNA for new.txt using bits 31 to 32 142069 .471 .6812
DNA for new.txt using bits 30 to 31 142067 .465 .6791
DNA for new.txt using bits 29 to 30 141604 -.901 .1839
DNA for new.txt using bits 28 to 29 142114 .604 .7270
DNA for new.txt using bits 27 to 28 142018 .321 .6257
DNA for new.txt using bits 26 to 27 141985 .223 .5883
DNA for new.txt using bits 25 to 26 141590 -.942 .1731
DNA for new.txt using bits 24 to 25 141902 -.022 .4914
DNA for new.txt using bits 23 to 24 141833 -.225 .4109
DNA for new.txt using bits 22 to 23 142956 3.088 .9990
DNA for new.txt using bits 21 to 22 141719 -.561 .2872
DNA for new.txt using bits 20 to 21 142045 .400 .6555
DNA for new.txt using bits 19 to 20 141541 -1.087 .1386
DNA for new.txt using bits 18 to 19 141870 -.116 .4538
DNA for new.txt using bits 17 to 18 142343 1.279 .8996
DNA for new.txt using bits 16 to 17 141810 -.293 .3848
DNA for new.txt using bits 15 to 16 141685 -.662 .2541
DNA for new.txt using bits 14 to 15 141470 -1.296 .0975
DNA for new.txt using bits 13 to 14 141745 -.485 .3139
DNA for new.txt using bits 12 to 13 141915 .017 .5067
DNA for new.txt using bits 11 to 12 141393 -1.523 .0639
DNA for new.txt using bits 10 to 11 141808 -.299 .3825
DNA for new.txt using bits 9 to 10 141349 -1.653 .0492
DNA for new.txt using bits 8 to 9 142064 .456 .6759
DNA for new.txt using bits 7 to 8 141995 .253 .5998
DNA for new.txt using bits 6 to 7 142293 1.132 .8711
DNA for new.txt using bits 5 to 6 142378 1.383 .9166
DNA for new.txt using bits 4 to 5 142021 .329 .6291
DNA for new.txt using bits 3 to 4 141845 -.190 .4247
DNA for new.txt using bits 2 to 3 141695 -.632 .2636
DNA for new.txt using bits 1 to 2 142515 1.787 .9630
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 new.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 new.txt 2502.37 .033 .513350
byte stream for new.txt 2485.10 -.211 .416565
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 2477.07 -.324 .372868
bits 2 to 9 2441.99 -.820 .205992
bits 3 to 10 2389.92 -1.557 .059762
bits 4 to 11 2507.83 .111 .544066
bits 5 to 12 2591.03 1.287 .901023
bits 6 to 13 2514.39 .203 .580614
bits 7 to 14 2447.13 -.748 .227340
bits 8 to 15 2471.46 -.404 .343252
bits 9 to 16 2347.29 -2.160 .015399
bits 10 to 17 2475.84 -.342 .366285
bits 11 to 18 2452.71 -.669 .251798
bits 12 to 19 2425.96 -1.047 .147534
bits 13 to 20 2446.70 -.754 .225479
bits 14 to 21 2324.31 -2.485 .006485
bits 15 to 22 2539.29 .556 .710762
bits 16 to 23 2570.09 .991 .839226
bits 17 to 24 2549.83 .705 .759493
bits 18 to 25 2503.45 .049 .519457
bits 19 to 26 2417.20 -1.171 .120814
bits 20 to 27 2562.21 .880 .810522
bits 21 to 28 2531.92 .451 .674154
bits 22 to 29 2471.01 -.410 .340902
bits 23 to 30 2466.96 -.467 .320139
bits 24 to 31 2515.33 .217 .585793
bits 25 to 32 2493.69 -.089 .464473
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 new.txt
Of 12,000 tries, the average no. of successes
should be 3523 with sigma=21.9
Successes: 3516 z-score: -.320 p-value: .374623
Successes: 3543 z-score: .913 p-value: .819442
Successes: 3508 z-score: -.685 p-value: .246694
Successes: 3493 z-score: -1.370 p-value: .085365
Successes: 3551 z-score: 1.279 p-value: .899470
Successes: 3517 z-score: -.274 p-value: .392053
Successes: 3521 z-score: -.091 p-value: .463618
Successes: 3529 z-score: .274 p-value: .607947
Successes: 3530 z-score: .320 p-value: .625377
Successes: 3545 z-score: 1.005 p-value: .842447
square size avg. no. parked sample sigma
100. 3525.300 17.038
KSTEST for the above 10: p= .070056
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 new.txt
Sample no. d^2 avg equiv uni
5 .2498 .8916 .222015
10 .4809 .7716 .383247
15 1.4591 .7074 .769250
20 .0071 .6520 .007067
25 2.2304 .7632 .893714
30 1.1343 .8796 .680195
35 .2388 .8780 .213335
40 .0133 .8168 .013272
45 .4447 .7960 .360414
50 1.8616 .8865 .846021
55 .8882 .8912 .590455
60 .5956 .8731 .450431
65 .2088 .8682 .189304
70 2.8002 .9028 .940050
75 .2072 .8730 .187978
80 .3083 .8480 .266414
85 .1516 .8721 .141329
90 .3406 .8534 .289883
95 .8218 .8557 .562153
100 .2235 .8277 .201164
MINIMUM DISTANCE TEST for new.txt
Result of KS test on 20 transformed mindist^2's:
p-value= .671322
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 new.txt
sample no: 1 r^3= 53.922 p-value= .83427
sample no: 2 r^3= 1.684 p-value= .05459
sample no: 3 r^3= 5.860 p-value= .17744
sample no: 4 r^3= 3.871 p-value= .12107
sample no: 5 r^3= 7.769 p-value= .22815
sample no: 6 r^3= 17.089 p-value= .43426
sample no: 7 r^3= 40.699 p-value= .74248
sample no: 8 r^3= 8.909 p-value= .25693
sample no: 9 r^3= 11.503 p-value= .31849
sample no: 10 r^3= 35.324 p-value= .69194
sample no: 11 r^3= 44.650 p-value= .77425
sample no: 12 r^3= 18.977 p-value= .46877
sample no: 13 r^3= 57.422 p-value= .85252
sample no: 14 r^3= 36.292 p-value= .70172
sample no: 15 r^3= 25.582 p-value= .57376
sample no: 16 r^3= 7.097 p-value= .21066
sample no: 17 r^3= 19.240 p-value= .47341
sample no: 18 r^3= 18.123 p-value= .45343
sample no: 19 r^3= 1.484 p-value= .04826
sample no: 20 r^3= 10.382 p-value= .29252
A KS test is applied to those 20 p-values.
---------------------------------------------------------
3DSPHERES test for file new.txt p-value= .499682
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 new.txt
Table of standardized frequency counts
( (obs-exp)/sqrt(exp) )^2
for j taking values <=6,7,8,...,47,>=48:
-1.5 .1 2.7 .3 .4 -.2
.7 .1 -.1 .2 -.2 .8
.8 -.1 2.0 -.5 -.6 .4
-.4 -1.0 .7 .0 1.0 -2.2
-1.1 -.4 -.7 -.3 -1.0 2.0
-1.3 .5 1.0 .9 .6 -.5
-1.4 .2 -1.6 -.1 -.6 2.0
-.1
Chi-square with 42 degrees of freedom: 44.868
z-score= .313 p-value= .647595
______________________________________________________________
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 .831132
Test no. 2 p-value .302786
Test no. 3 p-value .205060
Test no. 4 p-value .660544
Test no. 5 p-value .344031
Test no. 6 p-value .058927
Test no. 7 p-value .325473
Test no. 8 p-value .169680
Test no. 9 p-value .971151
Test no. 10 p-value .127423
Results of the OSUM test for new.txt
KSTEST on the above 10 p-values: .635076
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 new.txt
Up and down runs in a sample of 10000
_________________________________________________
Run test for new.txt :
runs up; ks test for 10 p's: .492554
runs down; ks test for 10 p's: .819294
Run test for new.txt :
runs up; ks test for 10 p's: .780495
runs down; ks test for 10 p's: .503154
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 new.txt
No. of wins: Observed Expected
98494 98585.86
98494= No. of wins, z-score= -.411 pvalue= .34059
Analysis of Throws-per-Game:
Chisq= 16.43 for 20 degrees of freedom, p= .31026
Throws Observed Expected Chisq Sum
1 66931 66666.7 1.048 1.048
2 37517 37654.3 .501 1.549
3 26744 26954.7 1.647 3.196
4 19380 19313.5 .229 3.426
5 13884 13851.4 .077 3.502
6 9839 9943.5 1.099 4.601
7 7143 7145.0 .001 4.602
8 5129 5139.1 .020 4.622
9 3813 3699.9 3.459 8.081
10 2623 2666.3 .703 8.784
11 1937 1923.3 .097 8.881
12 1379 1388.7 .068 8.950
13 1008 1003.7 .018 8.968
14 764 726.1 1.974 10.942
15 558 525.8 1.967 12.909
16 364 381.2 .772 13.681
17 279 276.5 .022 13.703
18 193 200.8 .305 14.008
19 150 146.0 .110 14.119
20 94 106.2 1.405 15.523
21 271 287.1 .905 16.428
SUMMARY FOR new.txt
p-value for no. of wins: .340592
p-value for throws/game: .310259
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Results of DIEHARD battery of tests sent to file result.txt
|