Results from Diehard tests on a binary file with 2^24 bytes size generated by the
csprngAlvo starting with a=0 and x=0.
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 r
For a sample of size
500: mean
r using bits 1 to 24
1.976
duplicate number number
spacings observed expected
0 71. 67.668
1 134. 135.335
2 140. 135.335
3 86. 90.224
4 41. 45.112
5 20. 18.045
6 to INF 8. 8.282
Chisquare with
6 d.o.f. = 1.13 p-value= .019890
:::::::::::::::::::::::::::::::::::::::::
For a sample of size
500: mean
r using bits 2 to 25
2.120
duplicate number number
spacings observed expected
0 65. 67.668
1 128. 135.335
2 128. 135.335
3 96. 90.224
4 47. 45.112
5 24. 18.045
6 to INF 12. 8.282
Chisquare with
6 d.o.f. = 4.98 p-value= .454125
:::::::::::::::::::::::::::::::::::::::::
For a sample of size
500: mean
r using bits 3 to 26
2.116
duplicate number number
spacings observed expected
0 59. 67.668
1 121. 135.335
2 152. 135.335
3 88. 90.224
4 53. 45.112
5 15. 18.045
6 to INF 12. 8.282
Chisquare with
6 d.o.f. = 8.30 p-value= .782921
:::::::::::::::::::::::::::::::::::::::::
For a sample of size
500: mean
r using bits 4 to 27
2.090
duplicate number number
spacings observed expected
0 66. 67.668
1 121. 135.335
2 145. 135.335
3 87. 90.224
4 48. 45.112
5 23. 18.045
6 to INF 10.
8.282
Chisquare with
6 d.o.f. = 4.27 p-value= .359417
:::::::::::::::::::::::::::::::::::::::::
For a sample of size
500: mean
r using bits 5 to 28
1.976
duplicate number number
spacings observed expected
0 62. 67.668
1 136. 135.335
2 148. 135.335
3 84. 90.224
4 51. 45.112
5 16. 18.045
6 to INF 3. 8.282
Chisquare with
6 d.o.f. = 6.46 p-value= .626447
:::::::::::::::::::::::::::::::::::::::::
For a sample of size
500: mean
r using bits 6 to 29
1.974
duplicate number number
spacings observed expected
0 67. 67.668
1 130. 135.335
2 148. 135.335
3 88. 90.224
4 48. 45.112
5 13. 18.045
6 to INF 6. 8.282
Chisquare with
6 d.o.f. = 3.68 p-value= .280223
:::::::::::::::::::::::::::::::::::::::::
For a sample of size
500: mean
r using bits
7 to 30 2.110
duplicate number number
spacings observed expected
0 51. 67.668
1 138. 135.335
2 139. 135.335
3 93. 90.224
4 47. 45.112
5 24. 18.045
6 to INF 8. 8.282
Chisquare with
6 d.o.f. = 6.40 p-value= .619753
:::::::::::::::::::::::::::::::::::::::::
For a sample of size
500: mean
r using bits 8 to 31
2.028
duplicate number number
spacings observed expected
0 64. 67.668
1 137. 135.335
2 135. 135.335
3 90. 90.224
4 43. 45.112
5 22. 18.045
6 to INF 9. 8.282
Chisquare with
6 d.o.f. = 1.25 p-value= .025592
:::::::::::::::::::::::::::::::::::::::::
For a sample of size
500: mean
r using bits 9 to 32
2.000
duplicate number number
spacings observed expected
0 62. 67.668
1 149. 135.335
2 125.
135.335
3 98. 90.224
4 37. 45.112
5 20. 18.045
6 to INF 9. 8.282
Chisquare with
6 d.o.f. = 5.05 p-value= .462167
:::::::::::::::::::::::::::::::::::::::::
The 9 p-values were
.019890 .454125 .782921
.359417 .626447
.280223 .619753 .025592
.462167
A KSTEST for the 9 p-values yields
.667359
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 r
For a sample of 1,000,000 consecutive 5-tuples,
chisquare for 99 degrees of freedom= 83.547;
p-value= .132755
OPERM5 test for file r
For a sample of 1,000,000 consecutive 5-tuples,
chisquare for 99 degrees of freedom=102.651;
p-value= .619335
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 r
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 186 211.4
3.055915 3.056
29 5179 5134.0
.394249 3.450
30 23086 23103.0
.012578 3.463
31 11549 11551.5
.000552 3.463
chisquare= 3.463 for 3 d. of f.; p-value= .705819
--------------------------------------------------------------
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 r
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 210 211.4
.009511 .010
30 5117 5134.0
.056359 .066
31 23291 23103.0
1.529079 1.595
32 11382 11551.5
2.487856 4.083
chisquare= 4.083 for 3 d. of f.; p-value= .769001
--------------------------------------------------------------
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 r
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 1 to 8
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 952
944.3 .063 .063
r =5 21657 21743.9 .347 .410
r =6 77391 77311.8 .081 .491
p=1-exp(-SUM/2)= .21776
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 2 to 9
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 963 944.3 .370 .370
r =5 21578 21743.9 1.266 1.636
r =6 77459 77311.8 .280 1.916
p=1-exp(-SUM/2)= .61640
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 3 to 10
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 930 944.3 .217 .217
r =5 21733 21743.9 .005 .222
r =6 77337 77311.8 .008
.230
p=1-exp(-SUM/2)= .10875
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 4 to 11
OBSERVED EXPECTED (O-E)^2/E
SUM
r<=4 927 944.3 .317 .317
r =5 21878 21743.9 .827 1.144
r =6 77195 77311.8 .176 1.320
p=1-exp(-SUM/2)= .48327
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 5 to 12
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 921 944.3 .575 .575
r =5 21775 21743.9 .044 .619
r =6 77304 77311.8 .001 .620
p=1-exp(-SUM/2)= .26664
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 6 to 13
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 928 944.3 .281 .281
r =5 21912 21743.9 1.300 1.581
r =6 77160
77311.8 .298 1.879
p=1-exp(-SUM/2)= .60918
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 7 to 14
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 940 944.3 .020 .020
r =5 21658 21743.9 .339 .359
r =6 77402 77311.8 .105 .464
p=1-exp(-SUM/2)= .20712
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 8 to 15
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 971 944.3
.755 .755
r =5 21745 21743.9 .000 .755
r =6 77284 77311.8 .010 .765
p=1-exp(-SUM/2)= .31782
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 9 to 16
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 939 944.3 .030 .030
r =5 21776 21743.9 .047
.077
r =6 77285 77311.8 .009 .086
p=1-exp(-SUM/2)= .04230
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 10 to 17
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 955 944.3 .121 .121
r =5 21737 21743.9 .002 .123
r =6 77308 77311.8 .000 .124
p=1-exp(-SUM/2)= .05993
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 11 to 18
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 987 944.3 1.931 1.931
r =5 21664 21743.9 .294 2.224
r =6 77349 77311.8 .018 2.242
p=1-exp(-SUM/2)= .67408
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 12 to 19
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 929 944.3 .248 .248
r =5 21747 21743.9 .000 .248
r =6 77324 77311.8 .002 .250
p=1-exp(-SUM/2)= .11764
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 13 to 20
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 937 944.3 .056 .056
r =5 21788 21743.9 .089 .146
r =6 77275 77311.8 .018 .163
p=1-exp(-SUM/2)= .07846
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 14 to 21
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 951 944.3 .048 .048
r =5 21752 21743.9 .003 .051
r =6 77297 77311.8 .003 .053
p=1-exp(-SUM/2)= .02633
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 15 to 22
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 934 944.3 .112 .112
r =5 21672 21743.9 .238 .350
r =6 77394 77311.8 .087 .438
p=1-exp(-SUM/2)= .19648
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 16 to 23
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 921 944.3 .575 .575
r =5 21879 21743.9 .839 1.414
r =6 77200 77311.8 .162 1.576
p=1-exp(-SUM/2)= .54526
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 17 to 24
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 915 944.3 .909 .909
r =5 21815 21743.9 .232 1.142
r =6 77270 77311.8 .023 1.164
p=1-exp(-SUM/2)= .44130
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 18 to 25
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 948 944.3
.014 .014
r =5 21525 21743.9 2.204 2.218
r =6 77527 77311.8 .599 2.817
p=1-exp(-SUM/2)= .75551
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 19 to 26
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 934 944.3 .112 .112
r =5 21521 21743.9 2.285
2.397
r =6 77545 77311.8 .703 3.101
p=1-exp(-SUM/2)= .78783
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 20 to 27
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 994 944.3 2.616 2.616
r =5 21768 21743.9 .027 2.642
r =6 77238 77311.8 .070 2.713
p=1-exp(-SUM/2)= .74242
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 21 to 28
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 1036 944.3 8.905 8.905
r =5 21569 21743.9 1.407 10.311
r =6 77395 77311.8 .090 10.401
p=1-exp(-SUM/2)= .99449
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 22 to 29
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 944 944.3 .000 .000
r =5
21587 21743.9 1.132 1.132
r =6 77469 77311.8 .320 1.452
p=1-exp(-SUM/2)= .51613
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 23 to 30
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 895 944.3 2.574 2.574
r =5 21676 21743.9 .212 2.786
r =6 77429 77311.8 .178 2.964
p=1-exp(-SUM/2)= .77278
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 24 to 31
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 929 944.3 .248 .248
r =5 21694 21743.9 .115 .362
r =6 77377 77311.8 .055 .417
p=1-exp(-SUM/2)= .18837
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG r
b-rank test for bits 25 to 32
OBSERVED EXPECTED (O-E)^2/E SUM
r<=4 964 944.3 .411
.411
r =5 21573 21743.9 1.343 1.754
r =6 77463 77311.8 .296 2.050
p=1-exp(-SUM/2)= .64117
TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices
These should be 25 uniform [0,1] random
variables:
.217762 .616396 .108752
.483274 .266642
.609184 .207122 .317820
.042300 .059925
.674082 .117637 .078458
.026333 .196483
.545261 .441303 .755514
.787832 .742416
.994486 .516131 .772780
.188375 .641175
brank test summary for r
The KS test for those 25 supposed UNI's yields
KS p-value= .792248
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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: 141949 missing words, .09 sigmas from mean, p-value= .53693
tst no
2: 142534 missing words, 1.46 sigmas from mean, p-value= .92779
tst no
3: 141634 missing words, -.64 sigmas from mean, p-value= .26002
tst no
4: 141907 missing words, -.01 sigmas from mean, p-value= .49783
tst no
5: 142399 missing words, 1.14 sigmas from mean, p-value= .87371
tst no
6: 142166 missing words, .60 sigmas from mean, p-value= .72565
tst no
7: 142938 missing words, 2.40 sigmas from mean, p-value= .99188
tst no
8: 141741 missing words, -.39 sigmas from mean, p-value= .34705
tst no
9: 141036 missing words, -2.04 sigmas from mean, p-value= .02065
tst no 10:
141895 missing words, -.03 sigmas
from mean, p-value= .48665
tst no 11:
141960 missing words, .12
sigmas from mean, p-value= .54712
tst no 12:
142371 missing words, 1.08
sigmas from mean, p-value= .85963
tst no 13:
142193 missing words, .66
sigmas from mean, p-value= .74627
tst no 14:
141803 missing words, -.25
sigmas from mean, p-value= .40190
tst no 15:
142302 missing words, .92
sigmas from mean, p-value= .82055
tst no 16:
141654 missing words, -.60
sigmas from mean, p-value= .27540
tst no 17:
142114 missing words, .48
sigmas from mean, p-value= .68375
tst no 18:
141290 missing words, -1.45
sigmas from mean, p-value= .07394
tst no 19:
142085 missing words, .41
sigmas from mean, p-value= .65926
tst no 20:
142413 missing words, 1.18
sigmas from mean, p-value= .88036
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 r
Output: No. missing words (mw), equiv normal variate (z), p-value (p)
mw z p
OPSO for r using
bits 23 to 32 142528 2.133
.9836
OPSO for r using
bits 22 to 31 141864 -.156
.4379
OPSO for r using
bits 21 to 30 141810 -.343
.3660
OPSO for r using
bits 20 to 29 141983 .254
.6003
OPSO for r using
bits 19 to 28 141793 -.401
.3442
OPSO for r using
bits 18 to 27 141745 -.567
.2855
OPSO for r using
bits 17 to 26 142058 .513
.6959
OPSO for r using
bits 16 to 25 141938 .099
.5394
OPSO for r using
bits 15 to 24 141566 -1.184 .1182
OPSO for r using
bits 14 to 23 141966 .195
.5775
OPSO for r using
bits 13 to 22 141911 .006
.5023
OPSO for r using
bits 12 to 21 141761
-.511 .3045
OPSO for r using
bits 11 to 20 141769 -.484
.3142
OPSO for r using
bits 10 to 19 141585 -1.118 .1317
OPSO for r using
bits 9 to 18 142008
.340 .6332
OPSO for r using bits 8 to 17
141827 -.284 .3882
OPSO for r using
bits 7 to 16 141554 -1.225 .1102
OPSO for r using
bits 6 to 15 141960
.175 .5694
OPSO for r using bits
5 to 14 141609 -1.036 .1502
OPSO for r using
bits 4 to 13 141379 -1.829 .0337
OPSO for r using
bits 3 to 12 141878
-.108 .4570
OPSO for r using
bits 2 to 11 142315
1.399 .9191
OPSO for r using
bits 1 to 10 142408
1.720 .9572
OQSO test for generator r
Output: No. missing words (mw), equiv normal variate (z), p-value (p)
mw z
p
OQSO for r using
bits 28 to 32 141637 -.923
.1780
OQSO for r using
bits 27 to 31 141885 -.082
.4671
OQSO for r using
bits 26 to 30 141832 -.262 .3966
OQSO for r using
bits 25 to 29 141848 -.208
.4177
OQSO for r using
bits 24 to 28 142025 .392
.6525
OQSO for r using
bits 23 to 27 141735 -.591
.2773
OQSO for r using bits 22 to 26 142251
1.158 .8766
OQSO for r using
bits 21 to 25 141844 -.221
.4124
OQSO for r using
bits 20 to 24 141616 -.994
.1600
OQSO for r using
bits 19 to 23 142097 .636
.7377
OQSO for r using
bits 18 to 22 141766 -.486
.3135
OQSO for r using
bits 17 to 21 141624 -.967
.1667
OQSO for r using
bits 16 to 20 141808 -.343
.3656
OQSO for r using
bits 15 to 19 141660 -.845
.1990
OQSO for r using
bits 14 to 18 141927 .060
.5239
OQSO for r using
bits 13 to 17 142001 .311
.6220
OQSO for r using bits 12 to 16 142010
.341 .6335
OQSO for r using
bits 11 to 15 141556 -1.198 .1155
OQSO for r using
bits 10 to 14 141640 -.913
.1806
OQSO for r using
bits 9 to 13 141872
-.127 .4497
OQSO for r using
bits 8 to 12 141939
.101 .5401
OQSO for r using
bits 7 to 11 141746
-.554 .2899
OQSO for r using
bits 6 to 10 141770
-.472 .3184
OQSO for r using
bits 5 to 9
141844 -.221 .4124
OQSO for r using
bits 4 to 8
142217 1.043 .8515
OQSO for r using
bits 3 to 7
141886 -.079 .4685
OQSO for r using
bits 2 to 6
141364 -1.849 .0323
OQSO for r using
bits 1 to 5
141790 -.405 .3429
DNA test for generator r
Output: No. missing words (mw), equiv normal variate (z), p-value (p)
mw z
p
DNA for r using bits
31 to 32 141655 -.750
.2266
DNA for r using bits
30 to 31 141809 -.296
.3836
DNA for r using bits
29 to 30 142655 2.200
.9861
DNA for r using bits
28 to 29 142191 .831
.7970
DNA for r using bits
27 to 28 141847 -.184
.4271
DNA for r using bits
26 to 27 142036 .374
.6457
DNA for r using bits
25 to 26 142684 2.285
.9888
DNA for r using bits
24 to 25 141685 -.662
.2541
DNA for r using bits
23 to 24 142259 1.031
.8488
DNA for r using bits 22 to 23 141631
-.821 .2058
DNA for r using bits
21 to 22 141991 .241
.5952
DNA for r using bits
20 to 21 141526 -1.131 .1291
DNA for r using bits
19 to 20 141967 .170
.5675
DNA for r using bits
18 to 19 142020 .326
.6280
DNA for r using bits
17 to 18 142047 .406
.6577
DNA for r using bits
16 to 17 142342
1.276 .8991
DNA for r using bits
15 to 16 141575 -.986
.1620
DNA for r using bits
14 to 15 141889 -.060
.4761
DNA for r using bits
13 to 14 142018 .321
.6257
DNA for r using bits 12 to 13 142005
.282 .6111
DNA for r using bits
11 to 12 142086 .521
.6989
DNA for r using bits
10 to 11 142453 1.604
.9456
DNA for r using bits
9 to 10 142113 .601
.7260
DNA for r using
bits 8 to 9
142214 .899 .8156
DNA for r using
bits 7 to 8
142375 1.374 .9152
DNA for r using
bits 6 to 7 141279 -1.859 .0315
DNA for r using
bits 5 to 6
142372 1.365 .9138
DNA for r using
bits 4 to 5
141871 -.113 .4550
DNA for r using
bits 3 to 4
141618 -.859 .1951
DNA for r using
bits 2 to 3
142381 1.391 .9179
DNA for r using
bits 1 to 2
142154 .722 .7648
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 r
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 r 2440.97 -.835
.201922
byte stream for r 2605.05 1.486
.931312
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 2570.02
.990 .838981
bits
2 to 9 2553.95
.763 .777249
bits
3 to 10 2543.04 .609
.728623
bits
4 to 11 2484.06 -.225
.410819
bits
5 to 12 2527.65 .391
.652122
bits
6 to 13 2421.27 -1.113
.132779
bits
7 to 14 2638.45 1.958
.974881
bits
8 to 15 2486.28 -.194
.423068
bits
9 to 16 2586.97 1.230
.890632
bits 10 to 17 2471.74
-.400 .344702
bits 11 to 18 2417.98
-1.160 .123045
bits 12 to 19 2458.99
-.580 .280954
bits 13 to 20 2552.52
.743 .771200
bits 14 to 21 2595.06
1.344 .910581
bits 15 to 22 2494.17
-.082 .467170
bits 16 to 23 2628.16
1.812 .965037
bits 17 to 24 2440.41
-.843 .199687
bits 18 to 25 2464.89
-.497 .309749
bits 19 to 26 2358.92
-1.995 .023012
bits 20 to 27 2391.11
-1.540 .061785
bits 21 to 28 2524.68
.349 .636444
bits 22 to 29 2625.28
1.772 .961784
bits 23 to 30 2530.87
.437 .668782
bits 24 to 31 2564.56
.913 .819373
bits 25 to 32 2545.95
.650 .742111
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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
r
Of 12,000 tries, the average no. of
successes
should be 3523 with sigma=21.9
Successes: 3506 z-score:
-.776 p-value: .218799
Successes: 3533 z-score:
.457 p-value: .676028
Successes: 3512 z-score:
-.502 p-value: .307734
Successes: 3531 z-score:
.365 p-value: .642555
Successes: 3531 z-score:
.365 p-value: .642555
Successes: 3535 z-score:
.548 p-value: .708135
Successes: 3519 z-score:
-.183 p-value: .427537
Successes: 3510 z-score:
-.594 p-value: .276387
Successes: 3498 z-score: -1.142 p-value: .126820
Successes: 3531 z-score:
.365 p-value: .642555
square size avg. no.
parked sample sigma
100. 3520.600 12.603
KSTEST for the above 10: p= .531466
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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
r
Sample no. d^2
avg equiv uni
5
1.5616 1.5286 .791848
10 .8487 1.1111
.573850
15 .2022
1.0660 .183933
20 .9298 1.0494
.607190
25 .1745 .9983
.160854
30 1.0929 1.0249
.666588
35 .9675 .9587
.621830
40 .1332 .8994
.125299
45 1.7202 .9176
.822518
50 1.2156 .9902
.705287
55 .0765 .9449
.074043
60 .8634 .9693
.580113
65 .4567 .9459
.368104
70 2.1581 .9330 .885706
75 .3245 .9024
.278261
80 .2273 .9164
.204209
85 1.3652 .9197
.746419
90 .9107 .9359
.599588
95 .2089 .9186
.189407
100 .3095 .9860
.267327
MINIMUM DISTANCE TEST for r
Result of KS test on 20 transformed mindist^2's:
p-value=
.396722
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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
r
sample no: 1 r^3=
8.921 p-value= .25724
sample no: 2
r^3= 7.303 p-value= .21607
sample no: 3
r^3= 83.643 p-value= .93846
sample no: 4
r^3= 29.604 p-value= .62724
sample no: 5
r^3= 135.331 p-value= .98901
sample no: 6
r^3= .638 p-value= .02105
sample no: 7
r^3= 24.753 p-value= .56181
sample no: 8
r^3= 115.542 p-value= .97875
sample no: 9
r^3= 46.558 p-value= .78816
sample no: 10 r^3=
15.416 p-value= .40183
sample no: 11 r^3=
42.892 p-value= .76063
sample no: 12 r^3=
29.090 p-value= .62079
sample no: 13 r^3=
70.952 p-value= .90606
sample no: 14 r^3=
28.286 p-value= .61049
sample no: 15 r^3=
11.472 p-value= .31777
sample no: 16 r^3=
40.063 p-value= .73696
sample no: 17 r^3=
66.649 p-value= .89157
sample no: 18 r^3=
41.209 p-value= .74682
sample no: 19 r^3=
1.267 p-value= .04136
sample no: 20 r^3=
6.506 p-value= .19495
A KS test is applied to those 20
p-values.
---------------------------------------------------------
3DSPHERES test for file r p-value= .710845
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 r
Table of standardized frequency counts
( (obs-exp)/sqrt(exp) )^2
for j taking values <=6,7,8,...,47,>=48:
.6 -.7 -1.1
-.7 1.4 -.8
-.1 .2 -.5
.4 1.2 .8
-.1 -1.7 .9
.6 -.8 -2.0
.2 -.4 .6
-1.1 .7 .7
1.3 1.4 -.2
-.1 .5 .1
-2.1 -.1 -1.5
2.5 -1.2 .2
.5 .5
1.3 .4 .1
.0
3.7
Chi-square with 42 degrees of
freedom: 53.556
z-score= 1.261
p-value= .891198
______________________________________________________________
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 .854371
Test no. 2
p-value .127077
Test no. 3
p-value .978117
Test no. 4
p-value .912676
Test no. 5
p-value .569122
Test no. 6
p-value .040260
Test no. 7
p-value .989737
Test no. 8
p-value .167504
Test no. 9
p-value .161345
Test no. 10 p-value
.986013
Results of the OSUM test for r
KSTEST on the above 10 p-values:
.965667
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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
:: 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 r
Up and down runs in a sample of 10000
_________________________________________________
Run test for r :