Below is the output of randomness tests for a sample of random numbers generated by SHAZAM.
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 random.bin
For a sample of size 500: mean
random.bin using bits 1 to 24 2.012
duplicate number number
spacings observed expected
0 60. 67.668
1 141. 135.335
2 138. 135.335
3 84. 90.224
4 56. 45.112
5 14. 18.045
6 to INF 7. 8.282
Chisquare with 6 d.o.f. = 5.32 p-value= .496616
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
random.bin using bits 2 to 25 1.992
duplicate number number
spacings observed expected
0 67. 67.668
1 129. 135.335
2 143. 135.335
3 95. 90.224
4 41. 45.112
5 18. 18.045
6 to INF 7. 8.282
Chisquare with 6 d.o.f. = 1.56 p-value= .044827
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
random.bin using bits 3 to 26 2.096
duplicate number number
spacings observed expected
0 58. 67.668
1 128. 135.335
2 139. 135.335
3 96. 90.224
4 53. 45.112
5 17. 18.045
6 to INF 9. 8.282
Chisquare with 6 d.o.f. = 3.75 p-value= .289530
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
random.bin using bits 4 to 27 2.138
duplicate number number
spacings observed expected
0 59. 67.668
1 122. 135.335
2 129. 135.335
3 111. 90.224
4 52. 45.112
5 17. 18.045
6 to INF 10. 8.282
Chisquare with 6 d.o.f. = 8.97 p-value= .824949
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
random.bin using bits 5 to 28 1.984
duplicate number number
spacings observed expected
0 73. 67.668
1 131. 135.335
2 138. 135.335
3 87. 90.224
4 46. 45.112
5 15. 18.045
6 to INF 10. 8.282
Chisquare with 6 d.o.f. = 1.61 p-value= .048464
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
random.bin using bits 6 to 29 2.002
duplicate number number
spacings observed expected
0 62. 67.668
1 133. 135.335
2 148. 135.335
3 88. 90.224
4 46. 45.112
5 15. 18.045
6 to INF 8. 8.282
Chisquare with 6 d.o.f. = 2.30 p-value= .109414
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
random.bin using bits 7 to 30 2.026
duplicate number number
spacings observed expected
0 84. 67.668
1 114. 135.335
2 128. 135.335
3 95. 90.224
4 48. 45.112
5 23. 18.045
6 to INF 8. 8.282
Chisquare with 6 d.o.f. = 9.51 p-value= .853196
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
random.bin using bits 8 to 31 1.974
duplicate number number
spacings observed expected
0 64. 67.668
1 133. 135.335
2 148. 135.335
3 86. 90.224
4 48. 45.112
5 18. 18.045
6 to INF 3. 8.282
Chisquare with 6 d.o.f. = 5.18 p-value= .478493
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500: mean
random.bin using bits 9 to 32 1.994
duplicate number number
spacings observed expected
0 69. 67.668
1 137. 135.335
2 124. 135.335
3 100. 90.224
4 47. 45.112
5 15. 18.045
6 to INF 8. 8.282
Chisquare with 6 d.o.f. = 2.66 p-value= .149599
:::::::::::::::::::::::::::::::::::::::::
The 9 p-values were
.496616 .044827 .289530 .824949 .048464
.109414 .853196 .478493 .149599
A KSTEST for the 9 p-values yields .795405
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 random.bin
For a sample of 1,000,000 consecutive 5-tuples,
chisquare for 99 degrees of freedom= 76.482; p-value= .045287
OPERM5 test for file random.bin
For a sample of 1,000,000 consecutive 5-tuples,
chisquare for 99 degrees of freedom= 92.959; p-value= .347906
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 random.bin
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 225 211.4 .872538 .873
29 5236 5134.0 2.026079 2.899
30 22956 23103.0 .935928 3.835
31 11583 11551.5 .085765 3.920
chisquare= 3.920 for 3 d. of f.; p-value= .753654
--------------------------------------------------------------
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 random.bin
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 5166 5134.0 .199326 .211
31 22993 23103.0 .524187 .735
32 11628 11551.5 .506298 1.242
chisquare= 1.242 for 3 d. of f.; p-value= .389544
--------------------------------------------------------------
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 random.bin
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 1 to 8
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 934 944.3 .112 .112
r =5 21605 21743.9 .887 1.000
r =6 77461 77311.8 .288 1.288
p=1-exp(-SUM/2)= .47470
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 2 to 9
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 968 944.3 .595 .595
r =5 21545 21743.9 1.819 2.414
r =6 77487 77311.8 .397 2.811
p=1-exp(-SUM/2)= .75478
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 3 to 10
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 930 944.3 .217 .217
r =5 21595 21743.9 1.020 1.236
r =6 77475 77311.8 .344 1.581
p=1-exp(-SUM/2)= .54632
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 4 to 11
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 917 944.3 .789 .789
r =5 21623 21743.9 .672 1.462
r =6 77460 77311.8 .284 1.746
p=1-exp(-SUM/2)= .58222
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 5 to 12
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 902 944.3 1.895 1.895
r =5 21578 21743.9 1.266 3.161
r =6 77520 77311.8 .561 3.721
p=1-exp(-SUM/2)= .84443
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 6 to 13
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 940 944.3 .020 .020
r =5 21749 21743.9 .001 .021
r =6 77311 77311.8 .000 .021
p=1-exp(-SUM/2)= .01034
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 7 to 14
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 958 944.3 .199 .199
r =5 21779 21743.9 .057 .255
r =6 77263 77311.8 .031 .286
p=1-exp(-SUM/2)= .13333
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 8 to 15
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 993 944.3 2.511 2.511
r =5 21925 21743.9 1.508 4.020
r =6 77082 77311.8 .683 4.703
p=1-exp(-SUM/2)= .90477
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 9 to 16
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 989 944.3 2.116 2.116
r =5 21740 21743.9 .001 2.117
r =6 77271 77311.8 .022 2.138
p=1-exp(-SUM/2)= .65666
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 10 to 17
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 923 944.3 .481 .481
r =5 21778 21743.9 .053 .534
r =6 77299 77311.8 .002 .536
p=1-exp(-SUM/2)= .23513
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 11 to 18
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 953 944.3 .080 .080
r =5 21653 21743.9 .380 .460
r =6 77394 77311.8 .087 .548
p=1-exp(-SUM/2)= .23949
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 12 to 19
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 949 944.3 .023 .023
r =5 21725 21743.9 .016 .040
r =6 77326 77311.8 .003 .042
p=1-exp(-SUM/2)= .02098
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 13 to 20
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 954 944.3 .100 .100
r =5 21783 21743.9 .070 .170
r =6 77263 77311.8 .031 .201
p=1-exp(-SUM/2)= .09549
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 14 to 21
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 894 944.3 2.679 2.679
r =5 21683 21743.9 .171 2.850
r =6 77423 77311.8 .160 3.010
p=1-exp(-SUM/2)= .77798
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 15 to 22
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 912 944.3 1.105 1.105
r =5 21609 21743.9 .837 1.942
r =6 77479 77311.8 .362 2.303
p=1-exp(-SUM/2)= .68390
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 16 to 23
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 939 944.3 .030 .030
r =5 21682 21743.9 .176 .206
r =6 77379 77311.8 .058 .264
p=1-exp(-SUM/2)= .12383
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 17 to 24
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 906 944.3 1.554 1.554
r =5 21838 21743.9 .407 1.961
r =6 77256 77311.8 .040 2.001
p=1-exp(-SUM/2)= .63231
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 18 to 25
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 940 944.3 .020 .020
r =5 21629 21743.9 .607 .627
r =6 77431 77311.8 .184 .811
p=1-exp(-SUM/2)= .33320
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 19 to 26
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 933 944.3 .135 .135
r =5 21827 21743.9 .318 .453
r =6 77240 77311.8 .067 .520
p=1-exp(-SUM/2)= .22877
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 20 to 27
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 982 944.3 1.505 1.505
r =5 21582 21743.9 1.205 2.710
r =6 77436 77311.8 .200 2.910
p=1-exp(-SUM/2)= .76660
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 21 to 28
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 947 944.3 .008 .008
r =5 21938 21743.9 1.733 1.740
r =6 77115 77311.8 .501 2.241
p=1-exp(-SUM/2)= .67394
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 22 to 29
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 925 944.3 .395 .395
r =5 21806 21743.9 .177 .572
r =6 77269 77311.8 .024 .596
p=1-exp(-SUM/2)= .25754
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 23 to 30
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 926 944.3 .355 .355
r =5 21664 21743.9 .294 .648
r =6 77410 77311.8 .125 .773
p=1-exp(-SUM/2)= .32057
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 24 to 31
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 890 944.3 3.123 3.123
r =5 21721 21743.9 .024 3.147
r =6 77389 77311.8 .077 3.224
p=1-exp(-SUM/2)= .80049
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG random.bin
b-rank test for bits 25 to 32
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 953 944.3 .080 .080
r =5 21983 21743.9 2.629 2.709
r =6 77064 77311.8 .794 3.504
p=1-exp(-SUM/2)= .82654
TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices
These should be 25 uniform [0,1] random variables:
.474704 .754779 .546321 .582225 .844434
.010344 .133329 .904767 .656659 .235132
.239488 .020984 .095493 .777978 .683905
.123826 .632309 .333198 .228766 .766600
.673941 .257538 .320574 .800487 .826538
brank test summary for random.bin
The KS test for those 25 supposed UNI's yields
KS p-value= .269484
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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: 142658 missing words, 1.75 sigmas from mean, p-value= .95987
tst no 2: 141366 missing words, -1.27 sigmas from mean, p-value= .10214
tst no 3: 142681 missing words, 1.80 sigmas from mean, p-value= .96430
tst no 4: 141777 missing words, -.31 sigmas from mean, p-value= .37859
tst no 5: 141927 missing words, .04 sigmas from mean, p-value= .51647
tst no 6: 142449 missing words, 1.26 sigmas from mean, p-value= .89633
tst no 7: 142433 missing words, 1.22 sigmas from mean, p-value= .88944
tst no 8: 141461 missing words, -1.05 sigmas from mean, p-value= .14744
tst no 9: 142373 missing words, 1.08 sigmas from mean, p-value= .86067
tst no 10: 141870 missing words, -.09 sigmas from mean, p-value= .46339
tst no 11: 141282 missing words, -1.47 sigmas from mean, p-value= .07136
tst no 12: 142388 missing words, 1.12 sigmas from mean, p-value= .86830
tst no 13: 141170 missing words, -1.73 sigmas from mean, p-value= .04205
tst no 14: 141644 missing words, -.62 sigmas from mean, p-value= .26765
tst no 15: 141811 missing words, -.23 sigmas from mean, p-value= .40915
tst no 16: 142354 missing words, 1.04 sigmas from mean, p-value= .85059
tst no 17: 141826 missing words, -.19 sigmas from mean, p-value= .42282
tst no 18: 142002 missing words, .22 sigmas from mean, p-value= .58571
tst no 19: 141849 missing words, -.14 sigmas from mean, p-value= .44395
tst no 20: 141457 missing words, -1.06 sigmas from mean, p-value= .14529
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 random.bin
Output: No. missing words (mw), equiv normal variate (z), p-value (p)
mw z p
OPSO for random.bin using bits 23 to 32 142381 1.626 .9481
OPSO for random.bin using bits 22 to 31 141899 -.036 .4858
OPSO for random.bin using bits 21 to 30 141513 -1.367 .0859
OPSO for random.bin using bits 20 to 29 142064 .533 .7031
OPSO for random.bin using bits 19 to 28 142400 1.692 .9547
OPSO for random.bin using bits 18 to 27 141937 .095 .5380
OPSO for random.bin using bits 17 to 26 141627 -.974 .1651
OPSO for random.bin using bits 16 to 25 142240 1.140 .8729
OPSO for random.bin using bits 15 to 24 141473 -1.505 .0662
OPSO for random.bin using bits 14 to 23 141732 -.611 .2704
OPSO for random.bin using bits 13 to 22 142162 .871 .8082
OPSO for random.bin using bits 12 to 21 142689 2.689 .9964
OPSO for random.bin using bits 11 to 20 142578 2.306 .9894
OPSO for random.bin using bits 10 to 19 141770 -.480 .3155
OPSO for random.bin using bits 9 to 18 141808 -.349 .3634
OPSO for random.bin using bits 8 to 17 141287 -2.146 .0159
OPSO for random.bin using bits 7 to 16 141913 .013 .5051
OPSO for random.bin using bits 6 to 15 141841 -.236 .4069
OPSO for random.bin using bits 5 to 14 142009 .344 .6345
OPSO for random.bin using bits 4 to 13 142558 2.237 .9874
OPSO for random.bin using bits 3 to 12 142034 .430 .6664
OPSO for random.bin using bits 2 to 11 142541 2.178 .9853
OPSO for random.bin using bits 1 to 10 142086 .609 .7288
OQSO test for generator random.bin
Output: No. missing words (mw), equiv normal variate (z), p-value (p)
mw z p
OQSO for random.bin using bits 28 to 32 141981 .243 .5960
OQSO for random.bin using bits 27 to 31 141807 -.347 .3643
OQSO for random.bin using bits 26 to 30 142302 1.331 .9084
OQSO for random.bin using bits 25 to 29 141877 -.110 .4564
OQSO for random.bin using bits 24 to 28 142333 1.436 .9245
OQSO for random.bin using bits 23 to 27 141946 .124 .5495
OQSO for random.bin using bits 22 to 26 141927 .060 .5239
OQSO for random.bin using bits 21 to 25 141661 -.842 .2000
OQSO for random.bin using bits 20 to 24 141825 -.286 .3875
OQSO for random.bin using bits 19 to 23 142157 .840 .7994
OQSO for random.bin using bits 18 to 22 142231 1.090 .8622
OQSO for random.bin using bits 17 to 21 142512 2.043 .9795
OQSO for random.bin using bits 16 to 20 142102 .653 .7432
OQSO for random.bin using bits 15 to 19 141460 -1.523 .0639
OQSO for random.bin using bits 14 to 18 141787 -.415 .3392
OQSO for random.bin using bits 13 to 17 141863 -.157 .4376
OQSO for random.bin using bits 12 to 16 142164 .863 .8060
OQSO for random.bin using bits 11 to 15 141807 -.347 .3643
OQSO for random.bin using bits 10 to 14 141813 -.327 .3720
OQSO for random.bin using bits 9 to 13 141581 -1.113 .1329
OQSO for random.bin using bits 8 to 12 141592 -1.076 .1410
OQSO for random.bin using bits 7 to 11 141966 .192 .5762
OQSO for random.bin using bits 6 to 10 142226 1.073 .8585
OQSO for random.bin using bits 5 to 9 141967 .195 .5775
OQSO for random.bin using bits 4 to 8 141833 -.259 .3979
OQSO for random.bin using bits 3 to 7 141575 -1.133 .1285
OQSO for random.bin using bits 2 to 6 142092 .619 .7321
OQSO for random.bin using bits 1 to 5 142421 1.734 .9586
DNA test for generator random.bin
Output: No. missing words (mw), equiv normal variate (z), p-value (p)
mw z p
DNA for random.bin using bits 31 to 32 141981 .211 .5837
DNA for random.bin using bits 30 to 31 142381 1.391 .9179
DNA for random.bin using bits 29 to 30 141594 -.930 .1761
DNA for random.bin using bits 28 to 29 142267 1.055 .8543
DNA for random.bin using bits 27 to 28 141913 .011 .5043
DNA for random.bin using bits 26 to 27 142019 .324 .6268
DNA for random.bin using bits 25 to 26 142173 .778 .7817
DNA for random.bin using bits 24 to 25 141426 -1.426 .0770
DNA for random.bin using bits 23 to 24 141846 -.187 .4259
DNA for random.bin using bits 22 to 23 142030 .356 .6391
DNA for random.bin using bits 21 to 22 142005 .282 .6111
DNA for random.bin using bits 20 to 21 141609 -.886 .1878
DNA for random.bin using bits 19 to 20 141733 -.520 .3015
DNA for random.bin using bits 18 to 19 142613 2.076 .9810
DNA for random.bin using bits 17 to 18 142126 .639 .7386
DNA for random.bin using bits 16 to 17 141785 -.367 .3569
DNA for random.bin using bits 15 to 16 141757 -.449 .3266
DNA for random.bin using bits 14 to 15 142024 .338 .6324
DNA for random.bin using bits 13 to 14 141584 -.960 .1686
DNA for random.bin using bits 12 to 13 141388 -1.538 .0620
DNA for random.bin using bits 11 to 12 141324 -1.727 .0421
DNA for random.bin using bits 10 to 11 142196 .846 .8011
DNA for random.bin using bits 9 to 10 141963 .158 .5629
DNA for random.bin using bits 8 to 9 141935 .076 .5302
DNA for random.bin using bits 7 to 8 142072 .480 .6843
DNA for random.bin using bits 6 to 7 141550 -1.060 .1446
DNA for random.bin using bits 5 to 6 141951 .123 .5489
DNA for random.bin using bits 4 to 5 141559 -1.033 .1507
DNA for random.bin using bits 3 to 4 142316 1.200 .8849
DNA for random.bin using bits 2 to 3 141459 -1.328 .0920
DNA for random.bin using bits 1 to 2 141888 -.063 .4749
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 random.bin
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 random.bin 2460.51 -.558 .288283
byte stream for random.bin 2495.53 -.063 .474799
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 2635.96 1.923 .972742
bits 2 to 9 2465.13 -.493 .310954
bits 3 to 10 2609.94 1.555 .939998
bits 4 to 11 2540.09 .567 .714624
bits 5 to 12 2538.92 .550 .708974
bits 6 to 13 2523.67 .335 .631068
bits 7 to 14 2489.66 -.146 .441849
bits 8 to 15 2523.87 .338 .632155
bits 9 to 16 2520.74 .293 .615349
bits 10 to 17 2617.52 1.662 .951735
bits 11 to 18 2494.29 -.081 .467813
bits 12 to 19 2512.27 .173 .568855
bits 13 to 20 2679.63 2.540 .994463
bits 14 to 21 2435.50 -.912 .180850
bits 15 to 22 2432.51 -.954 .169920
bits 16 to 23 2570.23 .993 .839688
bits 17 to 24 2431.20 -.973 .165271
bits 18 to 25 2573.64 1.041 .851169
bits 19 to 26 2556.31 .796 .787101
bits 20 to 27 2508.96 .127 .550430
bits 21 to 28 2558.91 .833 .797599
bits 22 to 29 2617.27 1.659 .951393
bits 23 to 30 2705.74 2.910 .998191
bits 24 to 31 2623.60 1.748 .959760
bits 25 to 32 2559.02 .835 .798035
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 random.bin
Of 12,000 tries, the average no. of successes
should be 3523 with sigma=21.9
Successes: 3537 z-score: .639 p-value: .738676
Successes: 3563 z-score: 1.826 p-value: .966111
Successes: 3557 z-score: 1.553 p-value: .939730
Successes: 3509 z-score: -.639 p-value: .261324
Successes: 3491 z-score: -1.461 p-value: .071982
Successes: 3505 z-score: -.822 p-value: .205562
Successes: 3545 z-score: 1.005 p-value: .842447
Successes: 3563 z-score: 1.826 p-value: .966111
Successes: 3489 z-score: -1.553 p-value: .060270
Successes: 3524 z-score: .046 p-value: .518210
square size avg. no. parked sample sigma
100. 3528.300 27.304
KSTEST for the above 10: p= .737366
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 random.bin
Sample no. d^2 avg equiv uni
5 .2533 1.3247 .224729
10 .2548 1.0779 .225954
15 .5611 .8978 .431047
20 .0430 .7738 .042274
25 .0794 .7475 .076694
30 .4375 .9053 .355787
35 .8719 .9206 .583664
40 1.2506 .8981 .715461
45 .0094 .8593 .009406
50 .1211 .8737 .114582
55 .1949 .9239 .177910
60 .5600 .8916 .430412
65 .4029 .8939 .332963
70 .3988 .8656 .330233
75 .7194 .8866 .514712
80 .4678 .9199 .375120
85 .3008 .9176 .260883
90 1.5067 .9148 .780032
95 2.4685 .9877 .916331
100 .5607 .9712 .430773
MINIMUM DISTANCE TEST for random.bin
Result of KS test on 20 transformed mindist^2's:
p-value= .162004
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 random.bin
sample no: 1 r^3= 42.396 p-value= .75663
sample no: 2 r^3= 10.854 p-value= .30357
sample no: 3 r^3= 20.692 p-value= .49829
sample no: 4 r^3= 109.440 p-value= .97396
sample no: 5 r^3= 35.620 p-value= .69497
sample no: 6 r^3= 13.720 p-value= .36702
sample no: 7 r^3= 3.472 p-value= .10930
sample no: 8 r^3= 5.351 p-value= .16337
sample no: 9 r^3= 21.495 p-value= .51153
sample no: 10 r^3= 18.559 p-value= .46133
sample no: 11 r^3= 88.265 p-value= .94725
sample no: 12 r^3= 71.511 p-value= .90779
sample no: 13 r^3= 4.725 p-value= .14573
sample no: 14 r^3= 11.853 p-value= .32638
sample no: 15 r^3= 24.356 p-value= .55598
sample no: 16 r^3= 130.026 p-value= .98689
sample no: 17 r^3= 19.991 p-value= .48643
sample no: 18 r^3= 26.105 p-value= .58111
sample no: 19 r^3= 32.279 p-value= .65903
sample no: 20 r^3= 43.891 p-value= .76847
A KS test is applied to those 20 p-values.
---------------------------------------------------------
3DSPHERES test for file random.bin p-value= .494055
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 random.bin
Table of standardized frequency counts
( (obs-exp)/sqrt(exp) )^2
for j taking values <=6,7,8,...,47,>=48:
.6 -1.2 -.6 .2 -.1 .6
1.0 1.0 -.6 .0 -.8 -.6
-.1 -.6 .2 .3 .0 1.5
-1.3 .4 .1 1.2 -.4 -.9
-.5 .4 -.2 .2 1.1 .0
-.5 .8 .5 -.4 -1.2 -2.3
-1.2 -1.3 .1 -.7 -.6 .0
-.1
Chi-square with 42 degrees of freedom: 26.347
z-score= -1.708 p-value= .028298
______________________________________________________________
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 .762571
Test no. 2 p-value .490885
Test no. 3 p-value .348327
Test no. 4 p-value .089651
Test no. 5 p-value .040803
Test no. 6 p-value .458708
Test no. 7 p-value .262621
Test no. 8 p-value .854300
Test no. 9 p-value .980957
Test no. 10 p-value .182276
Results of the OSUM test for random.bin
KSTEST on the above 10 p-values: .149701
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 random.bin
Up and down runs in a sample of 10000
_________________________________________________
Run test for random.bin :
runs up; ks test for 10 p's: .607550
runs down; ks test for 10 p's: .101131
Run test for random.bin :
runs up; ks test for 10 p's: .159763
runs down; ks test for 10 p's: .640047
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 random.bin
No. of wins: Observed Expected
98709 98585.86
98709= No. of wins, z-score= .551 pvalue= .70910
Analysis of Throws-per-Game:
Chisq= 26.28 for 20 degrees of freedom, p= .84326
Throws Observed Expected Chisq Sum
1 66931 66666.7 1.048 1.048
2 37327 37654.3 2.845 3.893
3 26969 26954.7 .008 3.901
4 19358 19313.5 .103 4.004
5 13683 13851.4 2.048 6.051
6 9900 9943.5 .191 6.242
7 7309 7145.0 3.763 10.005
8 5070 5139.1 .928 10.934
9 3718 3699.9 .089 11.023
10 2587 2666.3 2.358 13.381
11 1972 1923.3 1.232 14.613
12 1389 1388.7 .000 14.613
13 1037 1003.7 1.104 15.716
14 726 726.1 .000 15.716
15 538 525.8 .281 15.998
16 395 381.2 .503 16.501
17 306 276.5 3.139 19.640
18 233 200.8 5.153 24.793
19 140 146.0 .245 25.038
20 106 106.2 .000 25.039
21 306 287.1 1.242 26.281
SUMMARY FOR random.bin
p-value for no. of wins: .709100
p-value for throws/game: .843258