
ENT TESTS:



DIEHARD TESTS:

TEST 1 
Entropy source: PIC18F2525 
NOTE: Most of the tests in DIEHARD return a pvalue,
which should be uniform on [0,1) if the input file contains
truly independent random bits. Those pvalues are obtained
by p=F(X), where F is the assumed distribution of the sample
random variable Xoften 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 pvalues 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 chisquare goodness of fit test :: ::
provides a p value. The first test uses bits 124 (counting ::
:: from the left) from integers in the specified file. ::
:: Then the file is closed and reopened. Next, bits 225 are
:: :: used to provide birthdays, then 326 and so on to bits
932. :: :: Each set of bits provides a pvalue, and the
nine pvalues :: :: provide a sample for a KSTEST. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
BIRTHDAY SPACINGS TEST, M= 512 N=2**24 LAMBDA= 2.0000
Results for test1 For a sample of size 500: mean test1
using bits 1 to 24 1.978 duplicate number number spacings
observed expected 0 77. 67.668 1 132. 135.335 2 132.
135.335 3 84. 90.224 4 49. 45.112 5 17. 18.045 6 to
INF 9. 8.282 Chisquare with 6 d.o.f. = 2.34 pvalue= .113930
::::::::::::::::::::::::::::::::::::::::: For a sample of
size 500: mean test1 using bits 2 to 25 1.942 duplicate
number number spacings observed expected 0 73. 67.668
1 145. 135.335 2 126. 135.335 3 83. 90.224 4 47. 45.112
5 19. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. =
2.66 pvalue= .149928
::::::::::::::::::::::::::::::::::::::::: For a sample of
size 500: mean test1 using bits 3 to 26 1.964 duplicate
number number spacings observed expected 0 80. 67.668
1 120. 135.335 2 153. 135.335 3 75. 90.224 4 42. 45.112
5 20. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. =
9.64 pvalue= .859468
::::::::::::::::::::::::::::::::::::::::: For a sample of
size 500: mean test1 using bits 4 to 27 1.996 duplicate
number number spacings observed expected 0 74. 67.668
1 116. 135.335 2 142. 135.335 3 108. 90.224 4 33.
45.112 5 22. 18.045 6 to INF 5. 8.282 Chisquare with 6
d.o.f. = 12.60 pvalue= .950243
::::::::::::::::::::::::::::::::::::::::: For a sample of
size 500: mean test1 using bits 5 to 28 1.868 duplicate
number number spacings observed expected 0 70. 67.668
1 159. 135.335 2 124. 135.335 3 95. 90.224 4 31. 45.112
5 13. 18.045 6 to INF 8. 8.282 Chisquare with 6 d.o.f. =
11.26 pvalue= .919192
::::::::::::::::::::::::::::::::::::::::: For a sample of
size 500: mean test1 using bits 6 to 29 1.906 duplicate
number number spacings observed expected 0 70. 67.668
1 133. 135.335 2 149. 135.335 3 84. 90.224 4 52. 45.112
5 11. 18.045 6 to INF 1. 8.282 Chisquare with 6 d.o.f. =
12.13 pvalue= .940961
::::::::::::::::::::::::::::::::::::::::: For a sample of
size 500: mean test1 using bits 7 to 30 2.000 duplicate
number number spacings observed expected 0 75. 67.668
1 129. 135.335 2 125. 135.335 3 102. 90.224 4 43.
45.112 5 16. 18.045 6 to INF 10. 8.282 Chisquare with 6
d.o.f. = 4.10 pvalue= .337465
::::::::::::::::::::::::::::::::::::::::: For a sample of
size 500: mean test1 using bits 8 to 31 1.924 duplicate
number number spacings observed expected 0 72. 67.668
1 145. 135.335 2 130. 135.335 3 81. 90.224 4 54. 45.112
5 12. 18.045 6 to INF 6. 8.282 Chisquare with 6 d.o.f. =
6.53 pvalue= .633049
::::::::::::::::::::::::::::::::::::::::: For a sample of
size 500: mean test1 using bits 9 to 32 1.986 duplicate
number number spacings observed expected 0 73. 67.668
1 138. 135.335 2 136. 135.335 3 80. 90.224 4 39. 45.112
5 22. 18.045 6 to INF 12. 8.282 Chisquare with 6 d.o.f. =
5.00 pvalue= .456022
::::::::::::::::::::::::::::::::::::::::: The 9 pvalues were
.113930 .149928 .859468 .950243 .919192 .940961 .337465
.633049 .456022 A KSTEST for the 9 pvalues yields .687191
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: THE OVERLAPPING 5PERMUTATION TEST :: :: This is the
OPERM5 test. It looks at a sequence of one mill :: :: ion
32bit 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 test1 For a sample of 1,000,000
consecutive 5tuples, chisquare for 99 degrees of
freedom=131.403; pvalue= .983682 OPERM5 test for file test1
For a sample of 1,000,000 consecutive 5tuples, chisquare
for 99 degrees of freedom=158.789; pvalue= .999868
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 test1 Rank test for 31x31 binary
matrices: rows from leftmost 31 bits of each 32bit integer
rank observed expected (oe)^2/e sum 28 205 211.4 .194832
.195 29 5230 5134.0 1.794705 1.990 30 23003 23103.0
.433249 2.423 31 11562 11551.5 .009500 2.432 chisquare=
2.432 for 3 d. of f.; pvalue= .571777

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the BINARY RANK TEST for 32x32 matrices. A random
32x :: :: 32 binary matrix is formed, each row a 32bit
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 test1 Rank test for 32x32 binary
matrices: rows from leftmost 32 bits of each 32bit integer
rank observed expected (oe)^2/e sum 29 189 211.4 2.377126
2.377 30 5208 5134.0 1.066317 3.443 31 23080 23103.0
.022991 3.466 32 11523 11551.5 .070436 3.537 chisquare=
3.537 for 3 d. of f.; pvalue= .713998

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the BINARY RANK TEST for 6x8 matrices. From each
of :: :: six random 32bit 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 chisquare test is performed on :: :: counts
for ranks 6,5 and <=4. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Binary Rank Test for test1 Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG test1 brank test for
bits 1 to 8 OBSERVED EXPECTED (OE)^2/E SUM r<=4 921 944.3
.575 .575 r =5 21752 21743.9 .003 .578 r =6 77327 77311.8
.003 .581 p=1exp(SUM/2)= .25210 Rank of a 6x8 binary
matrix, rows formed from eight bits of the RNG test1
brank test for bits 2 to 9 OBSERVED EXPECTED (OE)^2/E SUM
r<=4 964 944.3 .411 .411 r =5 21675 21743.9 .218 .629 r =6
77361 77311.8 .031 .661 p=1exp(SUM/2)= .28128 Rank of a
6x8 binary matrix, rows formed from eight bits of the RNG
test1 brank test for bits 3 to 10 OBSERVED EXPECTED
(OE)^2/E SUM r<=4 939 944.3 .030 .030 r =5 21811 21743.9
.207 .237 r =6 77250 77311.8 .049 .286 p=1exp(SUM/2)=
.13335 Rank of a 6x8 binary matrix, rows formed from eight
bits of the RNG test1 brank test for bits 4 to 11
OBSERVED EXPECTED (OE)^2/E SUM r<=4 949 944.3 .023 .023 r
=5 21646 21743.9 .441 .464 r =6 77405 77311.8 .112 .577
p=1exp(SUM/2)= .25043 Rank of a 6x8 binary matrix, rows
formed from eight bits of the RNG test1 brank test for bits
5 to 12 OBSERVED EXPECTED (OE)^2/E SUM r<=4 956 944.3
.145 .145 r =5 21872 21743.9 .755 .900 r =6 77172 77311.8
.253 1.152 p=1exp(SUM/2)= .43797 Rank of a 6x8 binary
matrix, rows formed from eight bits of the RNG test1
brank test for bits 6 to 13 OBSERVED EXPECTED (OE)^2/E SUM
r<=4 919 944.3 .678 .678 r =5 21614 21743.9 .776 1.454 r
=6 77467 77311.8 .312 1.765 p=1exp(SUM/2)= .58635 Rank
of a 6x8 binary matrix, rows formed from eight bits of the
RNG test1 brank test for bits 7 to 14 OBSERVED EXPECTED
(OE)^2/E SUM r<=4 931 944.3 .187 .187 r =5 21705 21743.9
.070 .257 r =6 77364 77311.8 .035 .292 p=1exp(SUM/2)=
.13593 Rank of a 6x8 binary matrix, rows formed from eight
bits of the RNG test1 brank test for bits 8 to 15
OBSERVED EXPECTED (OE)^2/E SUM r<=4 962 944.3 .332 .332 r
=5 21767 21743.9 .025 .356 r =6 77271 77311.8 .022 .378
p=1exp(SUM/2)= .17213 Rank of a 6x8 binary matrix, rows
formed from eight bits of the RNG test1 brank test for bits
9 to 16 OBSERVED EXPECTED (OE)^2/E SUM r<=4 949 944.3
.023 .023 r =5 21574 21743.9 1.328 1.351 r =6 77477
77311.8 .353 1.704 p=1exp(SUM/2)= .57342 Rank of a 6x8
binary matrix, rows formed from eight bits of the RNG test1
brank test for bits 10 to 17 OBSERVED EXPECTED (OE)^2/E
SUM r<=4 960 944.3 .261 .261 r =5 21504 21743.9 2.647
2.908 r =6 77536 77311.8 .650 3.558 p=1exp(SUM/2)=
.83119 Rank of a 6x8 binary matrix, rows formed from eight
bits of the RNG test1 brank test for bits 11 to 18
OBSERVED EXPECTED (OE)^2/E SUM r<=4 943 944.3 .002 .002 r
=5 21634 21743.9 .555 .557 r =6 77423 77311.8 .160 .717
p=1exp(SUM/2)= .30134 Rank of a 6x8 binary matrix, rows
formed from eight bits of the RNG test1 brank test for bits
12 to 19 OBSERVED EXPECTED (OE)^2/E SUM r<=4 920 944.3
.625 .625 r =5 21934 21743.9 1.662 2.287 r =6 77146
77311.8 .356 2.643 p=1exp(SUM/2)= .73326 Rank of a 6x8
binary matrix, rows formed from eight bits of the RNG test1
brank test for bits 13 to 20 OBSERVED EXPECTED (OE)^2/E
SUM r<=4 897 944.3 2.369 2.369 r =5 21786 21743.9 .082
2.451 r =6 77317 77311.8 .000 2.451 p=1exp(SUM/2)=
.70642 Rank of a 6x8 binary matrix, rows formed from eight
bits of the RNG test1 brank test for bits 14 to 21
OBSERVED EXPECTED (OE)^2/E SUM r<=4 926 944.3 .355 .355 r
=5 21612 21743.9 .800 1.155 r =6 77462 77311.8 .292 1.447
p=1exp(SUM/2)= .51485 Rank of a 6x8 binary matrix, rows
formed from eight bits of the RNG test1 brank test for bits
15 to 22 OBSERVED EXPECTED (OE)^2/E SUM r<=4 910 944.3
1.246 1.246 r =5 21671 21743.9 .244 1.490 r =6 77419
77311.8 .149 1.639 p=1exp(SUM/2)= .55935 Rank of a 6x8
binary matrix, rows formed from eight bits of the RNG test1
brank test for bits 16 to 23 OBSERVED EXPECTED (OE)^2/E
SUM r<=4 907 944.3 1.473 1.473 r =5 21663 21743.9 .301
1.774 r =6 77430 77311.8 .181 1.955 p=1exp(SUM/2)=
.62378 Rank of a 6x8 binary matrix, rows formed from eight
bits of the RNG test1 brank test for bits 17 to 24
OBSERVED EXPECTED (OE)^2/E SUM r<=4 909 944.3 1.320 1.320
r =5 21730 21743.9 .009 1.329 r =6 77361 77311.8 .031 1.360
p=1exp(SUM/2)= .49335 Rank of a 6x8 binary matrix, rows
formed from eight bits of the RNG test1 brank test for bits
18 to 25 OBSERVED EXPECTED (OE)^2/E SUM r<=4 940 944.3
.020 .020 r =5 21609 21743.9 .837 .857 r =6 77451 77311.8
.251 1.107 p=1exp(SUM/2)= .42510 Rank of a 6x8 binary
matrix, rows formed from eight bits of the RNG test1
brank test for bits 19 to 26 OBSERVED EXPECTED (OE)^2/E SUM
r<=4 967 944.3 .546 .546 r =5 21987 21743.9 2.718 3.264 r
=6 77046 77311.8 .914 4.177 p=1exp(SUM/2)= .87615 Rank
of a 6x8 binary matrix, rows formed from eight bits of the
RNG test1 brank test for bits 20 to 27 OBSERVED EXPECTED
(OE)^2/E SUM r<=4 997 944.3 2.941 2.941 r =5 21680
21743.9 .188 3.129 r =6 77323 77311.8 .002 3.130
p=1exp(SUM/2)= .79095 Rank of a 6x8 binary matrix, rows
formed from eight bits of the RNG test1 brank test for bits
21 to 28 OBSERVED EXPECTED (OE)^2/E SUM r<=4 967 944.3
.546 .546 r =5 21879 21743.9 .839 1.385 r =6 77154 77311.8
.322 1.707 p=1exp(SUM/2)= .57411 Rank of a 6x8 binary
matrix, rows formed from eight bits of the RNG test1
brank test for bits 22 to 29 OBSERVED EXPECTED (OE)^2/E SUM
r<=4 943 944.3 .002 .002 r =5 21867 21743.9 .697 .699 r =6
77190 77311.8 .192 .891 p=1exp(SUM/2)= .35937 Rank of a
6x8 binary matrix, rows formed from eight bits of the RNG
test1 brank test for bits 23 to 30 OBSERVED EXPECTED
(OE)^2/E SUM r<=4 920 944.3 .625 .625 r =5 21772 21743.9
.036 .662 r =6 77308 77311.8 .000 .662 p=1exp(SUM/2)=
.28175 Rank of a 6x8 binary matrix, rows formed from eight
bits of the RNG test1 brank test for bits 24 to 31
OBSERVED EXPECTED (OE)^2/E SUM r<=4 947 944.3 .008 .008 r
=5 21650 21743.9 .406 .413 r =6 77403 77311.8 .108 .521
p=1exp(SUM/2)= .22925 Rank of a 6x8 binary matrix, rows
formed from eight bits of the RNG test1 brank test for bits
25 to 32 OBSERVED EXPECTED (OE)^2/E SUM r<=4 958 944.3
.199 .199 r =5 21643 21743.9 .468 .667 r =6 77399 77311.8
.098 .765 p=1exp(SUM/2)= .31794 TEST SUMMARY, 25 tests
on 100,000 random 6x8 matrices These should be 25 uniform
[0,1] random variables: .252102 .281277 .133346 .250430
.437975 .586354 .135925 .172130 .573420 .831189 .301344
.733258 .706425 .514851 .559352 .623778 .493351 .425105
.876150 .790951 .574106 .359370 .281754 .229253 .317943
brank test summary for test1 The KS test for those 25
supposed UNI's yields KS pvalue= .770427
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 20letter ::
:: "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 20letter (20bit) words
in a string of :: :: 2^21 overlapping 20letter 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 :: :: (j141909)/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 20tuples 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: 141679 missing words, .54 sigmas from mean, pvalue=
.29524 tst no 2: 142013 missing words, .24 sigmas from mean,
pvalue= .59570 tst no 3: 141398 missing words, 1.19 sigmas
from mean, pvalue= .11610 tst no 4: 141891 missing words,
.04 sigmas from mean, pvalue= .48292 tst no 5: 141621
missing words, .67 sigmas from mean, pvalue= .25026 tst no
6: 141309 missing words, 1.40 sigmas from mean, pvalue= .08036
tst no 7: 141498 missing words, .96 sigmas from mean, pvalue=
.16826 tst no 8: 142029 missing words, .28 sigmas from mean,
pvalue= .61011 tst no 9: 141884 missing words, .06 sigmas
from mean, pvalue= .47641 tst no 10: 142204 missing words,
.69 sigmas from mean, pvalue= .75443 tst no 11: 142234
missing words, .76 sigmas from mean, pvalue= .77595 tst no
12: 142438 missing words, 1.24 sigmas from mean, pvalue= .89162
tst no 13: 142409 missing words, 1.17 sigmas from mean, pvalue=
.87849 tst no 14: 141894 missing words, .04 sigmas from
mean, pvalue= .48572 tst no 15: 142045 missing words, .32
sigmas from mean, pvalue= .62437 tst no 16: 142504 missing
words, 1.39 sigmas from mean, pvalue= .91765 tst no 17:
142618 missing words, 1.66 sigmas from mean, pvalue= .95112
tst no 18: 140938 missing words, 2.27 sigmas from mean,
pvalue= .01162 tst no 19: 142041 missing words, .31 sigmas
from mean, pvalue= .62082 tst no 20: 142630 missing words,
1.68 sigmas from mean, pvalue= .95389
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: The tests OPSO, OQSO and DNA :: :: OPSO means
OverlappingPairsSparseOccupancy :: :: The OPSO test
considers 2letter words from an alphabet of :: :: 1024
letters. Each letter is determined by a specified ten :: ::
bits from a 32bit integer in the sequence to be tested. OPSO ::
:: generates 2^21 (overlapping) 2letter words (from 2^21+1
:: :: "keystrokes") and counts the number of missing
wordsthat :: :: is 2letter 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 (missingwrds141909)/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 OverlappingQuadruplesSparseOccupancy :: :: The test
OQSO is similar, except that it considers 4letter :: ::
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 32bit 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 10letter 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) 10letter 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 test1 Output: No. missing words
(mw), equiv normal variate (z), pvalue (p) mw z p OPSO
for test1 using bits 23 to 32 141858 .177 .4298 OPSO for
test1 using bits 22 to 31 142527 2.130 .9834 OPSO for test1
using bits 21 to 30 142508 2.064 .9805 OPSO for test1 using
bits 20 to 29 142000 .313 .6227 OPSO for test1 using bits 19
to 28 141834 .260 .3975 OPSO for test1 using bits 18 to 27
142388 1.651 .9506 OPSO for test1 using bits 17 to 26 142009
.344 .6345 OPSO for test1 using bits 16 to 25 142294 1.326
.9077 OPSO for test1 using bits 15 to 24 142453 1.875 .9696
OPSO for test1 using bits 14 to 23 141954 .154 .5612 OPSO for
test1 using bits 13 to 22 141926 .057 .5229 OPSO for test1
using bits 12 to 21 141783 .436 .3316 OPSO for test1 using
bits 11 to 20 142430 1.795 .9637 OPSO for test1 using bits 10
to 19 142038 .444 .6714 OPSO for test1 using bits 9 to 18
141837 .249 .4015 OPSO for test1 using bits 8 to 17 141892
.060 .4762 OPSO for test1 using bits 7 to 16 141728 .625
.2659 OPSO for test1 using bits 6 to 15 141812 .336 .3686
OPSO for test1 using bits 5 to 14 142098 .651 .7423 OPSO for
test1 using bits 4 to 13 141864 .156 .4379 OPSO for test1
using bits 3 to 12 141353 1.918 .0275 OPSO for test1 using
bits 2 to 11 141573 1.160 .1231 OPSO for test1 using bits 1
to 10 142226 1.092 .8626 OQSO test for generator test1
Output: No. missing words (mw), equiv normal variate (z),
pvalue (p) mw z p OQSO for test1 using bits 28 to 32
141575 1.133 .1285 OQSO for test1 using bits 27 to 31 141998
.301 .6181 OQSO for test1 using bits 26 to 30 142348 1.487
.9315 OQSO for test1 using bits 25 to 29 142109 .677 .7508
OQSO for test1 using bits 24 to 28 141587 1.093 .1373 OQSO
for test1 using bits 23 to 27 141918 .029 .5117 OQSO for
test1 using bits 22 to 26 141951 .141 .5562 OQSO for test1
using bits 21 to 25 141818 .310 .3784 OQSO for test1 using
bits 20 to 24 141722 .635 .2627 OQSO for test1 using bits 19
to 23 142065 .528 .7011 OQSO for test1 using bits 18 to 22
142413 1.707 .9561 OQSO for test1 using bits 17 to 21 141944
.118 .5468 OQSO for test1 using bits 16 to 20 141507 1.364
.0863 OQSO for test1 using bits 15 to 19 141431 1.621 .0525
OQSO for test1 using bits 14 to 18 141972 .212 .5841 OQSO for
test1 using bits 13 to 17 141766 .486 .3135 OQSO for test1
using bits 12 to 16 142554 2.185 .9856 OQSO for test1 using
bits 11 to 15 142229 1.084 .8607 OQSO for test1 using bits 10
to 14 141522 1.313 .0946 OQSO for test1 using bits 9 to 13
141858 .174 .4309 OQSO for test1 using bits 8 to 12 142087
.602 .7265 OQSO for test1 using bits 7 to 11 142044 .457
.6760 OQSO for test1 using bits 6 to 10 141988 .267 .6051
OQSO for test1 using bits 5 to 9 141717 .652 .2572 OQSO for
test1 using bits 4 to 8 141941 .107 .5427 OQSO for test1
using bits 3 to 7 141920 .036 .5144 OQSO for test1 using bits
2 to 6 141308 2.038 .0208 OQSO for test1 using bits 1 to 5
141267 2.177 .0147 DNA test for generator test1 Output:
No. missing words (mw), equiv normal variate (z), pvalue (p)
mw z p DNA for test1 using bits 31 to 32 141750 .470 .3192
DNA for test1 using bits 30 to 31 141995 .253 .5998 DNA for
test1 using bits 29 to 30 141748 .476 .3171 DNA for test1
using bits 28 to 29 141565 1.016 .1549 DNA for test1 using
bits 27 to 28 142418 1.501 .9333 DNA for test1 using bits 26
to 27 141920 .031 .5126 DNA for test1 using bits 25 to 26
141537 1.098 .1360 DNA for test1 using bits 24 to 25 142262
1.040 .8509 DNA for test1 using bits 23 to 24 142189 .825
.7953 DNA for test1 using bits 22 to 23 141842 .199 .4213
DNA for test1 using bits 21 to 22 141653 .756 .2248 DNA for
test1 using bits 20 to 21 141521 1.146 .1260 DNA for test1
using bits 19 to 20 141635 .809 .2092 DNA for test1 using
bits 18 to 19 141569 1.004 .1577 DNA for test1 using bits 17
to 18 141798 .328 .3713 DNA for test1 using bits 16 to 17
141524 1.137 .1278 DNA for test1 using bits 15 to 16 142248
.999 .8411 DNA for test1 using bits 14 to 15 142210 .887
.8124 DNA for test1 using bits 13 to 14 141775 .396 .3460
DNA for test1 using bits 12 to 13 142154 .722 .7648 DNA for
test1 using bits 11 to 12 141563 1.022 .1535 DNA for test1
using bits 10 to 11 141415 1.458 .0724 DNA for test1 using
bits 9 to 10 141473 1.287 .0990 DNA for test1 using bits 8
to 9 141827 .243 .4041 DNA for test1 using bits 7 to 8
142167 .760 .7764 DNA for test1 using bits 6 to 7 141183
2.143 .0161 DNA for test1 using bits 5 to 6 141995 .253
.5998 DNA for test1 using bits 4 to 5 142017 .318 .6246
DNA for test1 using bits 3 to 4 141877 .095 .4620 DNA for
test1 using bits 2 to 3 141990 .238 .5940 DNA for test1 using
bits 1 to 2 141794 .340 .3669
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the COUNTTHE1'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 5letter :: :: 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 5letter words, and from a string of
256,000 (over :: :: lapping) 5letter 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:: Q5Q4, the
difference of the naive Pearson sums of :: ::
(OBSEXP)^2/EXP on counts for 5 and 4letter cell counts. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Test results for test1 Chisquare with 5^55^4=2500 d.of
f. for sample size:2560000 chisquare equiv normal pvalue
Results fo COUNTTHE1's in successive bytes: byte stream for
test1 2488.88 .157 .437511 byte stream for test1 2531.95
.452 .674322
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the COUNTTHE1's TEST for specific bytes. ::
:: Consider the file under test as a stream of 32bit 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) 5letter
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
5letter words, and :: :: from a string of 256,000
(overlapping) 5letter 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:: Q5Q4, the difference of ::
:: the naive Pearson sums of (OBSEXP)^2/EXP on counts for
5 :: :: and 4letter cell counts. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Chisquare with 5^55^4=2500 d.of f. for sample size: 256000
chisquare equiv normal p value Results for COUNTTHE1's in
specified bytes: bits 1 to 8 2658.39 2.240 .987453 bits 2
to 9 2532.28 .457 .676006 bits 3 to 10 2487.61 .175 .430442
bits 4 to 11 2448.76 .725 .234350 bits 5 to 12 2515.46 .219
.586534 bits 6 to 13 2574.13 1.048 .852776 bits 7 to 14
2536.15 .511 .695401 bits 8 to 15 2438.96 .863 .193994
bits 9 to 16 2582.73 1.170 .878993 bits 10 to 17 2564.05 .906
.817471 bits 11 to 18 2492.92 .100 .460105 bits 12 to 19
2540.93 .579 .718649 bits 13 to 20 2588.11 1.246 .893627
bits 14 to 21 2605.01 1.485 .931239 bits 15 to 22 2452.08
.678 .248973 bits 16 to 23 2543.26 .612 .729671 bits 17
to 24 2639.70 1.976 .975906 bits 18 to 25 2460.11 .564
.286328 bits 19 to 26 2548.82 .690 .755048 bits 20 to 27
2483.48 .234 .407637 bits 21 to 28 2623.50 1.747 .959639
bits 22 to 29 2536.86 .521 .698897 bits 23 to 30 2555.09 .779
.782039 bits 24 to 31 2474.44 .361 .358876 bits 25 to 32
2440.51 .841 .200087
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: THIS IS A PARKING LOT TEST :: :: In a square of side
100, randomly "park" a cara 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 (k3523)/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 test1 Of 12,000
tries, the average no. of successes should be 3523 with
sigma=21.9 Successes: 3505 zscore: .822 pvalue: .205562
Successes: 3508 zscore: .685 pvalue: .246694 Successes:
3536 zscore: .594 pvalue: .723613 Successes: 3533 zscore:
.457 pvalue: .676028 Successes: 3544 zscore: .959 pvalue:
.831196 Successes: 3538 zscore: .685 pvalue: .753306
Successes: 3521 zscore: .091 pvalue: .463618 Successes:
3553 zscore: 1.370 pvalue: .914635 Successes: 3551 zscore:
1.279 pvalue: .899470 Successes: 3550 zscore: 1.233
pvalue: .891189
square size avg. no. parked sample sigma
100. 3533.900 16.456 KSTEST for the above 10: p= .893812
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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^2n)/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 1exp(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 test1 Sample no. d^2 avg equiv uni 5 1.6352
.9600 .806678 10 2.7827 1.2902 .938986 15 .7697 1.0387
.538614 20 .4672 .9708 .374726 25 .2354 1.1740 .210667
30 .9094 1.2991 .599068 35 .9584 1.2461 .618352 40 1.2219
1.3726 .707140 45 1.0710 1.3186 .659162 50 .5160 1.3305
.404665 55 .2977 1.2463 .258556 60 3.4069 1.2907 .967420
65 .8146 1.2926 .559012 70 .3462 1.2310 .293870 75 4.5329
1.2606 .989493 80 .3873 1.2460 .322418 85 .6620 1.2551
.485879 90 .7637 1.2560 .535855 95 .5836 1.2410 .443751
100 .5891 1.2453 .446825 MINIMUM DISTANCE TEST for test1
Result of KS test on 20 transformed mindist^2's: pvalue=
.992516
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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
1exp(r^3/30.), then a :: :: KSTEST is done on the 20
pvalues. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
The 3DSPHERES test for file test1 sample no: 1 r^3=
1.378 pvalue= .04489 sample no: 2 r^3= 2.102 pvalue= .06765
sample no: 3 r^3= 5.058 pvalue= .15517 sample no: 4 r^3=
38.238 pvalue= .72046 sample no: 5 r^3= 54.851 pvalue=
.83932 sample no: 6 r^3= 33.678 pvalue= .67456 sample no:
7 r^3= 31.142 pvalue= .64586 sample no: 8 r^3= 4.200
pvalue= .13063 sample no: 9 r^3= 48.705 pvalue= .80279
sample no: 10 r^3= 10.270 pvalue= .28988 sample no: 11 r^3=
34.434 pvalue= .68267 sample no: 12 r^3= 5.079 pvalue=
.15575 sample no: 13 r^3= 39.034 pvalue= .72777 sample
no: 14 r^3= 49.623 pvalue= .80874 sample no: 15 r^3= 19.014
pvalue= .46943 sample no: 16 r^3= 24.378 pvalue= .55630
sample no: 17 r^3= 33.022 pvalue= .66737 sample no: 18 r^3=
58.761 pvalue= .85896 sample no: 19 r^3= 24.770 pvalue=
.56206 sample no: 20 r^3= .370 pvalue= .01227 A KS test
is applied to those 20 pvalues.

3DSPHERES test for file test1 pvalue= .504318
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 chisquare
test for cell frequencies. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
RESULTS OF SQUEEZE TEST FOR test1 Table of standardized
frequency counts ( (obsexp)/sqrt(exp) )^2 for j taking
values <=6,7,8,...,47,>=48: .1 .3 .3 1.1 1.6 .3 .2 .5
1.0 2.2 .2 .6 1.6 .3 .1 .7 1.4 .1 .3 .9 .7 .5 1.5
2.1 .0 2.1 .0 1.3 .1 .5 .9 .1 .7 .3 .5 .5 .0 .2 .9
.1 .1 1.0 .1 Chisquare with 42 degrees of freedom:
34.423 zscore= .827 pvalue= .209137
______________________________________________________________
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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
pvalues from ten :: :: KSTESTs are given still another
KSTEST. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Test no. 1 pvalue .913771 Test no. 2 pvalue .280257
Test no. 3 pvalue .554307 Test no. 4 pvalue .793627 Test
no. 5 pvalue .673222 Test no. 6 pvalue .235984 Test no.
7 pvalue .105186 Test no. 8 pvalue .114326 Test no. 9
pvalue .852223 Test no. 10 pvalue .265052 Results of the
OSUM test for test1 KSTEST on the above 10 pvalues: .083267
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 32bit integers in the specified file.
This example :: :: shows how runs are counted:
.123,.357,.789,.425,.224,.416,.95:: :: contains an uprun of
length 3, a downrun of length 2 and an :: :: uprun of (at
least) 2, depending on the next values. The :: :: covariance
matrices for the runsup and runsdown 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 test1 Up and down runs in a
sample of 10000
_________________________________________________ Run test
for test1 : runs up; ks test for 10 p's: .412041 runs
down; ks test for 10 p's: .119478 Run test for test1 :
runs up; ks test for 10 p's: .022722 runs down; ks test for
10 p's: .873031
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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(1p), 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
chisquare test is made on the no.ofthrows cell counts. ::
:: Each 32bit 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 test1 No. of wins: Observed
Expected 98730 98585.86 98730= No. of wins, zscore= .645
pvalue= .74043 Analysis of ThrowsperGame: Chisq= 19.52
for 20 degrees of freedom, p= .51186 Throws Observed Expected
Chisq Sum 1 66591 66666.7 .086 .086 2 37609 37654.3 .055
.140 3 26715 26954.7 2.132 2.273 4 19153 19313.5 1.333
3.606 5 14010 13851.4 1.816 5.421 6 9919 9943.5 .061 5.482
7 7291 7145.0 2.982 8.464 8 5215 5139.1 1.122 9.586 9 3808
3699.9 3.160 12.746 10 2741 2666.3 2.093 14.839 11 1916
1923.3 .028 14.867 12 1350 1388.7 1.081 15.948 13 1024
1003.7 .410 16.358 14 744 726.1 .439 16.797 15 535 525.8
.160 16.957 16 379 381.2 .012 16.969 17 253 276.5 2.004
18.973 18 199 200.8 .017 18.990 19 144 146.0 .027 19.016
20 105 106.2 .014 19.030 21 299 287.1 .492 19.522 SUMMARY
FOR test1 pvalue for no. of wins: .740433 pvalue for
throws/game: .511855
TEST 2 
Entropy source: PIC24EP512GP202 
NOTE: Most of the tests in DIEHARD return a
pvalue, which should be uniform on [0,1) if the input file
contains truly independent random bits. Those pvalues are
obtained by p=F(X), where F is the assumed distribution of
the sample random variable Xoften 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 pvalues 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 chisquare goodness of fit test :: ::
provides a p value. The first test uses bits 124 (counting ::
:: from the left) from integers in the specified file. ::
:: Then the file is closed and reopened. Next, bits 225 are
:: :: used to provide birthdays, then 326 and so on to bits
932. :: :: Each set of bits provides a pvalue, and the
nine pvalues :: :: provide a sample for a KSTEST. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
BIRTHDAY SPACINGS TEST, M= 512 N=2**24 LAMBDA= 2.0000
Results for test2 For a sample of size 500: mean test2
using bits 1 to 24 2.060 duplicate number number spacings
observed expected 0 53. 67.668 1 131. 135.335 2 158.
135.335 3 88. 90.224 4 45. 45.112 5 13. 18.045 6 to
INF 12. 8.282 Chisquare with 6 d.o.f. = 10.25 pvalue=
.885436 ::::::::::::::::::::::::::::::::::::::::: For a
sample of size 500: mean test2 using bits 2 to 25 2.034
duplicate number number spacings observed expected 0 64.
67.668 1 128. 135.335 2 143. 135.335 3 94. 90.224 4
44. 45.112 5 19. 18.045 6 to INF 8. 8.282 Chisquare
with 6 d.o.f. = 1.28 pvalue= .027040
::::::::::::::::::::::::::::::::::::::::: For a sample of
size 500: mean test2 using bits 3 to 26 1.910 duplicate
number number spacings observed expected 0 66. 67.668
1 140. 135.335 2 153. 135.335 3 78. 90.224 4 45. 45.112
5 14. 18.045 6 to INF 4. 8.282 Chisquare with 6 d.o.f. =
7.28 pvalue= .704644
::::::::::::::::::::::::::::::::::::::::: For a sample of
size 500: mean test2 using bits 4 to 27 1.902 duplicate
number number spacings observed expected 0 73. 67.668
1 144. 135.335 2 132. 135.335 3 95. 90.224 4 33. 45.112
5 15. 18.045 6 to INF 8. 8.282 Chisquare with 6 d.o.f. =
5.09 pvalue= .467061
::::::::::::::::::::::::::::::::::::::::: For a sample of
size 500: mean test2 using bits 5 to 28 2.022 duplicate
number number spacings observed expected 0 58. 67.668
1 148. 135.335 2 131. 135.335 3 90. 90.224 4 47. 45.112
5 16. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. =
3.37 pvalue= .239218
::::::::::::::::::::::::::::::::::::::::: For a sample of
size 500: mean test2 using bits 6 to 29 2.018 duplicate
number number spacings observed expected 0 69. 67.668
1 116. 135.335 2 152. 135.335 3 97. 90.224 4 44. 45.112
5 12. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. =
7.76 pvalue= .743657
::::::::::::::::::::::::::::::::::::::::: For a sample of
size 500: mean test2 using bits 7 to 30 2.020 duplicate
number number spacings observed expected 0 63. 67.668
1 135. 135.335 2 124. 135.335 3 111. 90.224 4 45.
45.112 5 18. 18.045 6 to INF 4. 8.282 Chisquare with 6
d.o.f. = 8.27 pvalue= .781067
::::::::::::::::::::::::::::::::::::::::: For a sample of
size 500: mean test2 using bits 8 to 31 2.078 duplicate
number number spacings observed expected 0 70. 67.668
1 121. 135.335 2 132. 135.335 3 98. 90.224 4 50. 45.112
5 18. 18.045 6 to INF 11. 8.282 Chisquare with 6 d.o.f. =
3.77 pvalue= .292669
::::::::::::::::::::::::::::::::::::::::: For a sample of
size 500: mean test2 using bits 9 to 32 2.060 duplicate
number number spacings observed expected 0 63. 67.668
1 128. 135.335 2 137. 135.335 3 98. 90.224 4 45. 45.112
5 21. 18.045 6 to INF 8. 8.282 Chisquare with 6 d.o.f. =
1.90 pvalue= .071702
::::::::::::::::::::::::::::::::::::::::: The 9 pvalues were
.885436 .027040 .704644 .467061 .239218 .743657 .781067
.292669 .071702 A KSTEST for the 9 pvalues yields .116131
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: THE OVERLAPPING 5PERMUTATION TEST :: :: This is the
OPERM5 test. It looks at a sequence of one mill :: :: ion
32bit 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 test2 For a sample of 1,000,000
consecutive 5tuples, chisquare for 99 degrees of
freedom=127.105; pvalue= .970001 OPERM5 test for file test2
For a sample of 1,000,000 consecutive 5tuples, chisquare
for 99 degrees of freedom=100.421; pvalue= .558774
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 test2 Rank test for 31x31 binary
matrices: rows from leftmost 31 bits of each 32bit integer
rank observed expected (oe)^2/e sum 28 214 211.4 .031533
.032 29 5144 5134.0 .019438 .051 30 23014 23103.0 .343216
.394 31 11628 11551.5 .506298 .900 chisquare= .900 for 3
d. of f.; pvalue= .346016

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the BINARY RANK TEST for 32x32 matrices. A random
32x :: :: 32 binary matrix is formed, each row a 32bit
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 test2 Rank test for 32x32 binary
matrices: rows from leftmost 32 bits of each 32bit integer
rank observed expected (oe)^2/e sum 29 202 211.4 .419543
.420 30 5160 5134.0 .131567 .551 31 23204 23103.0 .441134
.992 32 11434 11551.5 1.195685 2.188 chisquare= 2.188 for
3 d. of f.; pvalue= .535219

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the BINARY RANK TEST for 6x8 matrices. From each
of :: :: six random 32bit 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 chisquare test is performed on :: :: counts
for ranks 6,5 and <=4. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Binary Rank Test for test2 Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG test2 brank test for
bits 1 to 8 OBSERVED EXPECTED (OE)^2/E SUM r<=4 950 944.3
.034 .034 r =5 21815 21743.9 .232 .267 r =6 77235 77311.8
.076 .343 p=1exp(SUM/2)= .15767 Rank of a 6x8 binary
matrix, rows formed from eight bits of the RNG test2
brank test for bits 2 to 9 OBSERVED EXPECTED (OE)^2/E SUM
r<=4 936 944.3 .073 .073 r =5 21693 21743.9 .119 .192 r =6
77371 77311.8 .045 .237 p=1exp(SUM/2)= .11195 Rank of a
6x8 binary matrix, rows formed from eight bits of the RNG
test2 brank test for bits 3 to 10 OBSERVED EXPECTED
(OE)^2/E SUM r<=4 966 944.3 .499 .499 r =5 21805 21743.9
.172 .670 r =6 77229 77311.8 .089 .759 p=1exp(SUM/2)=
.31579 Rank of a 6x8 binary matrix, rows formed from eight
bits of the RNG test2 brank test for bits 4 to 11
OBSERVED EXPECTED (OE)^2/E SUM r<=4 958 944.3 .199 .199 r
=5 21573 21743.9 1.343 1.542 r =6 77469 77311.8 .320 1.862
p=1exp(SUM/2)= .60576 Rank of a 6x8 binary matrix, rows
formed from eight bits of the RNG test2 brank test for bits
5 to 12 OBSERVED EXPECTED (OE)^2/E SUM r<=4 940 944.3
.020 .020 r =5 21806 21743.9 .177 .197 r =6 77254 77311.8
.043 .240 p=1exp(SUM/2)= .11315 Rank of a 6x8 binary
matrix, rows formed from eight bits of the RNG test2
brank test for bits 6 to 13 OBSERVED EXPECTED (OE)^2/E SUM
r<=4 941 944.3 .012 .012 r =5 21726 21743.9 .015 .026 r =6
77333 77311.8 .006 .032 p=1exp(SUM/2)= .01592 Rank of a
6x8 binary matrix, rows formed from eight bits of the RNG
test2 brank test for bits 7 to 14 OBSERVED EXPECTED
(OE)^2/E SUM r<=4 922 944.3 .527 .527 r =5 21673 21743.9
.231 .758 r =6 77405 77311.8 .112 .870 p=1exp(SUM/2)=
.35280 Rank of a 6x8 binary matrix, rows formed from eight
bits of the RNG test2 brank test for bits 8 to 15
OBSERVED EXPECTED (OE)^2/E SUM r<=4 943 944.3 .002 .002 r
=5 21613 21743.9 .788 .790 r =6 77444 77311.8 .226 1.016
p=1exp(SUM/2)= .39826 Rank of a 6x8 binary matrix, rows
formed from eight bits of the RNG test2 brank test for bits
9 to 16 OBSERVED EXPECTED (OE)^2/E SUM r<=4 955 944.3
.121 .121 r =5 21462 21743.9 3.655 3.776 r =6 77583
77311.8 .951 4.727 p=1exp(SUM/2)= .90592 Rank of a 6x8
binary matrix, rows formed from eight bits of the RNG test2
brank test for bits 10 to 17 OBSERVED EXPECTED (OE)^2/E
SUM r<=4 932 944.3 .160 .160 r =5 21362 21743.9 6.708
6.868 r =6 77706 77311.8 2.010 8.878 p=1exp(SUM/2)=
.98819 Rank of a 6x8 binary matrix, rows formed from eight
bits of the RNG test2 brank test for bits 11 to 18
OBSERVED EXPECTED (OE)^2/E SUM r<=4 885 944.3 3.724 3.724
r =5 21582 21743.9 1.205 4.930 r =6 77533 77311.8 .633 5.562
p=1exp(SUM/2)= .93804 Rank of a 6x8 binary matrix, rows
formed from eight bits of the RNG test2 brank test for bits
12 to 19 OBSERVED EXPECTED (OE)^2/E SUM r<=4 918 944.3
.733 .733 r =5 21734 21743.9 .005 .737 r =6 77348 77311.8
.017 .754 p=1exp(SUM/2)= .31409 Rank of a 6x8 binary
matrix, rows formed from eight bits of the RNG test2
brank test for bits 13 to 20 OBSERVED EXPECTED (OE)^2/E SUM
r<=4 902 944.3 1.895 1.895 r =5 21542 21743.9 1.875 3.770
r =6 77556 77311.8 .771 4.541 p=1exp(SUM/2)= .89674 Rank
of a 6x8 binary matrix, rows formed from eight bits of the
RNG test2 brank test for bits 14 to 21 OBSERVED EXPECTED
(OE)^2/E SUM r<=4 883 944.3 3.979 3.979 r =5 21598
21743.9 .979 4.958 r =6 77519 77311.8 .555 5.514
p=1exp(SUM/2)= .93651 Rank of a 6x8 binary matrix, rows
formed from eight bits of the RNG test2 brank test for bits
15 to 22 OBSERVED EXPECTED (OE)^2/E SUM r<=4 980 944.3
1.350 1.350 r =5 21560 21743.9 1.555 2.905 r =6 77460
77311.8 .284 3.189 p=1exp(SUM/2)= .79699 Rank of a 6x8
binary matrix, rows formed from eight bits of the RNG test2
brank test for bits 16 to 23 OBSERVED EXPECTED (OE)^2/E
SUM r<=4 960 944.3 .261 .261 r =5 21603 21743.9 .913 1.174
r =6 77437 77311.8 .203 1.377 p=1exp(SUM/2)= .49761 Rank
of a 6x8 binary matrix, rows formed from eight bits of the
RNG test2 brank test for bits 17 to 24 OBSERVED EXPECTED
(OE)^2/E SUM r<=4 921 944.3 .575 .575 r =5 21743 21743.9
.000 .575 r =6 77336 77311.8 .008 .583 p=1exp(SUM/2)=
.25270 Rank of a 6x8 binary matrix, rows formed from eight
bits of the RNG test2 brank test for bits 18 to 25
OBSERVED EXPECTED (OE)^2/E SUM r<=4 963 944.3 .370 .370 r
=5 21280 21743.9 9.897 10.267 r =6 77757 77311.8 2.564 12.831
p=1exp(SUM/2)= .99836 Rank of a 6x8 binary matrix, rows
formed from eight bits of the RNG test2 brank test for bits
19 to 26 OBSERVED EXPECTED (OE)^2/E SUM r<=4 911 944.3
1.174 1.174 r =5 21730 21743.9 .009 1.183 r =6 77359
77311.8 .029 1.212 p=1exp(SUM/2)= .45449 Rank of a 6x8
binary matrix, rows formed from eight bits of the RNG test2
brank test for bits 20 to 27 OBSERVED EXPECTED (OE)^2/E
SUM r<=4 958 944.3 .199 .199 r =5 21855 21743.9 .568 .766
r =6 77187 77311.8 .201 .968 p=1exp(SUM/2)= .38364 Rank
of a 6x8 binary matrix, rows formed from eight bits of the
RNG test2 brank test for bits 21 to 28 OBSERVED EXPECTED
(OE)^2/E SUM r<=4 962 944.3 .332 .332 r =5 21804 21743.9
.166 .498 r =6 77234 77311.8 .078 .576 p=1exp(SUM/2)=
.25029 Rank of a 6x8 binary matrix, rows formed from eight
bits of the RNG test2 brank test for bits 22 to 29
OBSERVED EXPECTED (OE)^2/E SUM r<=4 885 944.3 3.724 3.724
r =5 21629 21743.9 .607 4.331 r =6 77486 77311.8 .392 4.724
p=1exp(SUM/2)= .90576 Rank of a 6x8 binary matrix, rows
formed from eight bits of the RNG test2 brank test for bits
23 to 30 OBSERVED EXPECTED (OE)^2/E SUM r<=4 958 944.3
.199 .199 r =5 21784 21743.9 .074 .273 r =6 77258 77311.8
.037 .310 p=1exp(SUM/2)= .14364 Rank of a 6x8 binary
matrix, rows formed from eight bits of the RNG test2
brank test for bits 24 to 31 OBSERVED EXPECTED (OE)^2/E SUM
r<=4 959 944.3 .229 .229 r =5 21560 21743.9 1.555 1.784 r
=6 77481 77311.8 .370 2.154 p=1exp(SUM/2)= .65946 Rank
of a 6x8 binary matrix, rows formed from eight bits of the
RNG test2 brank test for bits 25 to 32 OBSERVED EXPECTED
(OE)^2/E SUM r<=4 962 944.3 .332 .332 r =5 21583 21743.9
1.191 1.522 r =6 77455 77311.8 .265 1.788 p=1exp(SUM/2)=
.59090 TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices
These should be 25 uniform [0,1] random variables: .157675
.111949 .315791 .605756 .113153 .015916 .352803 .398262
.905921 .988190 .938036 .314088 .896738 .936511 .796989
.497610 .252703 .998364 .454494 .383642 .250289 .905755
.143636 .659457 .590897 brank test summary for test2 The
KS test for those 25 supposed UNI's yields KS pvalue=
.550253
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 20letter ::
:: "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 20letter (20bit) words
in a string of :: :: 2^21 overlapping 20letter 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 :: :: (j141909)/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 20tuples 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: 141999 missing words, .21 sigmas from mean, pvalue=
.58298 tst no 2: 141428 missing words, 1.12 sigmas from
mean, pvalue= .13038 tst no 3: 142119 missing words, .49
sigmas from mean, pvalue= .68789 tst no 4: 141780 missing
words, .30 sigmas from mean, pvalue= .38126 tst no 5:
141111 missing words, 1.87 sigmas from mean, pvalue= .03107
tst no 6: 142333 missing words, .99 sigmas from mean, pvalue=
.83889 tst no 7: 141956 missing words, .11 sigmas from mean,
pvalue= .54342 tst no 8: 141808 missing words, .24 sigmas
from mean, pvalue= .40643 tst no 9: 141713 missing words,
.46 sigmas from mean, pvalue= .32322 tst no 10: 142234
missing words, .76 sigmas from mean, pvalue= .77595 tst no
11: 141440 missing words, 1.10 sigmas from mean, pvalue=
.13642 tst no 12: 141590 missing words, .75 sigmas from
mean, pvalue= .22781 tst no 13: 141436 missing words, 1.11
sigmas from mean, pvalue= .13438 tst no 14: 140896 missing
words, 2.37 sigmas from mean, pvalue= .00895 tst no 15:
140879 missing words, 2.41 sigmas from mean, pvalue= .00804
tst no 16: 142698 missing words, 1.84 sigmas from mean, pvalue=
.96731 tst no 17: 142288 missing words, .88 sigmas from mean,
pvalue= .81185 tst no 18: 141412 missing words, 1.16 sigmas
from mean, pvalue= .12262 tst no 19: 142813 missing words,
2.11 sigmas from mean, pvalue= .98263 tst no 20: 141881
missing words, .07 sigmas from mean, pvalue= .47361
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: The tests OPSO, OQSO and DNA :: :: OPSO means
OverlappingPairsSparseOccupancy :: :: The OPSO test
considers 2letter words from an alphabet of :: :: 1024
letters. Each letter is determined by a specified ten :: ::
bits from a 32bit integer in the sequence to be tested. OPSO ::
:: generates 2^21 (overlapping) 2letter words (from 2^21+1
:: :: "keystrokes") and counts the number of missing
wordsthat :: :: is 2letter 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 (missingwrds141909)/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 OverlappingQuadruplesSparseOccupancy :: :: The test
OQSO is similar, except that it considers 4letter :: ::
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 32bit 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 10letter 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) 10letter 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 test2 Output: No. missing words
(mw), equiv normal variate (z), pvalue (p) mw z p OPSO
for test2 using bits 23 to 32 142050 .485 .6862 OPSO for
test2 using bits 22 to 31 141966 .195 .5775 OPSO for test2
using bits 21 to 30 142635 2.502 .9938 OPSO for test2 using
bits 20 to 29 141944 .120 .5476 OPSO for test2 using bits 19
to 28 141874 .122 .4515 OPSO for test2 using bits 18 to 27
142123 .737 .7694 OPSO for test2 using bits 17 to 26 142439
1.826 .9661 OPSO for test2 using bits 16 to 25 142134 .775
.7808 OPSO for test2 using bits 15 to 24 141554 1.225 .1102
OPSO for test2 using bits 14 to 23 141775 .463 .3216 OPSO
for test2 using bits 13 to 22 141661 .856 .1959 OPSO for
test2 using bits 12 to 21 142576 2.299 .9892 OPSO for test2
using bits 11 to 20 142016 .368 .6435 OPSO for test2 using
bits 10 to 19 142126 .747 .7725 OPSO for test2 using bits 9
to 18 141954 .154 .5612 OPSO for test2 using bits 8 to 17
142382 1.630 .9484 OPSO for test2 using bits 7 to 16 141896
.046 .4817 OPSO for test2 using bits 6 to 15 142236 1.126
.8700 OPSO for test2 using bits 5 to 14 142380 1.623 .9477
OPSO for test2 using bits 4 to 13 141916 .023 .5092 OPSO for
test2 using bits 3 to 12 141484 1.467 .0712 OPSO for test2
using bits 2 to 11 141729 .622 .2670 OPSO for test2 using
bits 1 to 10 141511 1.374 .0848 OQSO test for generator
test2 Output: No. missing words (mw), equiv normal variate
(z), pvalue (p) mw z p OQSO for test2 using bits 28 to 32
141854 .188 .4256 OQSO for test2 using bits 27 to 31 141881
.096 .4617 OQSO for test2 using bits 26 to 30 142218 1.046
.8523 OQSO for test2 using bits 25 to 29 141878 .106 .4577
OQSO for test2 using bits 24 to 28 141656 .859 .1952 OQSO
for test2 using bits 23 to 27 141917 .026 .5104 OQSO for
test2 using bits 22 to 26 142291 1.294 .9021 OQSO for test2
using bits 21 to 25 141838 .242 .4045 OQSO for test2 using
bits 20 to 24 142064 .524 .7000 OQSO for test2 using bits 19
to 23 141142 2.601 .0046 OQSO for test2 using bits 18 to 22
142020 .375 .6462 OQSO for test2 using bits 17 to 21 141955
.155 .5615 OQSO for test2 using bits 16 to 20 141792 .398
.3454 OQSO for test2 using bits 15 to 19 142450 1.833 .9666
OQSO for test2 using bits 14 to 18 141819 .306 .3797 OQSO
for test2 using bits 13 to 17 142042 .450 .6735 OQSO for
test2 using bits 12 to 16 142070 .545 .7070 OQSO for test2
using bits 11 to 15 141454 1.543 .0614 OQSO for test2 using
bits 10 to 14 142284 1.270 .8980 OQSO for test2 using bits 9
to 13 141981 .243 .5960 OQSO for test2 using bits 8 to 12
142114 .694 .7561 OQSO for test2 using bits 7 to 11 141648
.886 .1878 OQSO for test2 using bits 6 to 10 141772 .466
.3208 OQSO for test2 using bits 5 to 9 141672 .805 .2106
OQSO for test2 using bits 4 to 8 141966 .192 .5762 OQSO for
test2 using bits 3 to 7 141685 .760 .2235 OQSO for test2
using bits 2 to 6 141864 .154 .4389 OQSO for test2 using
bits 1 to 5 142258 1.182 .8814 DNA test for generator test2
Output: No. missing words (mw), equiv normal variate (z),
pvalue (p) mw z p DNA for test2 using bits 31 to 32
142173 .778 .7817 DNA for test2 using bits 30 to 31 141741
.497 .3098 DNA for test2 using bits 29 to 30 141914 .014
.5055 DNA for test2 using bits 28 to 29 142116 .610 .7290
DNA for test2 using bits 27 to 28 141427 1.423 .0774 DNA for
test2 using bits 26 to 27 141958 .144 .5571 DNA for test2
using bits 25 to 26 141477 1.275 .1011 DNA for test2 using
bits 24 to 25 142005 .282 .6111 DNA for test2 using bits 23
to 24 141989 .235 .5929 DNA for test2 using bits 22 to 23
141542 1.084 .1393 DNA for test2 using bits 21 to 22 142529
1.828 .9662 DNA for test2 using bits 20 to 21 142445 1.580
.9430 DNA for test2 using bits 19 to 20 142053 .424 .6641
DNA for test2 using bits 18 to 19 141439 1.387 .0827 DNA for
test2 using bits 17 to 18 142300 1.152 .8754 DNA for test2
using bits 16 to 17 141606 .895 .1855 DNA for test2 using
bits 15 to 16 142192 .834 .7978 DNA for test2 using bits 14
to 15 141618 .859 .1951 DNA for test2 using bits 13 to 14
141624 .842 .2000 DNA for test2 using bits 12 to 13 142709
2.359 .9908 DNA for test2 using bits 11 to 12 142231 .949
.8287 DNA for test2 using bits 10 to 11 141980 .208 .5826
DNA for test2 using bits 9 to 10 142249 1.002 .8418 DNA for
test2 using bits 8 to 9 142080 .503 .6927 DNA for test2 using
bits 7 to 8 142446 1.583 .9433 DNA for test2 using bits 6 to
7 141838 .210 .4167 DNA for test2 using bits 5 to 6 142292
1.129 .8705 DNA for test2 using bits 4 to 5 142160 .739 .7702
DNA for test2 using bits 3 to 4 141934 .073 .5290 DNA for
test2 using bits 2 to 3 141701 .615 .2694 DNA for test2
using bits 1 to 2 142273 1.073 .8583
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the COUNTTHE1'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 5letter :: :: 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 5letter words, and from a string of
256,000 (over :: :: lapping) 5letter 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:: Q5Q4, the
difference of the naive Pearson sums of :: ::
(OBSEXP)^2/EXP on counts for 5 and 4letter cell counts. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Test results for test2 Chisquare with 5^55^4=2500 d.of
f. for sample size:2560000 chisquare equiv normal pvalue
Results fo COUNTTHE1's in successive bytes: byte stream for
test2 2534.65 .490 .687927 byte stream for test2 2530.42 .430
.666480
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the COUNTTHE1's TEST for specific bytes. ::
:: Consider the file under test as a stream of 32bit 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) 5letter
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
5letter words, and :: :: from a string of 256,000
(overlapping) 5letter 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:: Q5Q4, the difference of ::
:: the naive Pearson sums of (OBSEXP)^2/EXP on counts for
5 :: :: and 4letter cell counts. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Chisquare with 5^55^4=2500 d.of f. for sample size: 256000
chisquare equiv normal p value Results for COUNTTHE1's in
specified bytes: bits 1 to 8 2379.32 1.707 .043937 bits 2
to 9 2557.94 .819 .793737 bits 3 to 10 2599.84 1.412 .921016
bits 4 to 11 2542.56 .602 .726360 bits 5 to 12 2476.99 .325
.372445 bits 6 to 13 2383.61 1.646 .049888 bits 7 to 14
2586.83 1.228 .890274 bits 8 to 15 2504.97 .070 .528040
bits 9 to 16 2540.97 .579 .718854 bits 10 to 17 2412.05
1.244 .106789 bits 11 to 18 2538.03 .538 .704663 bits 12
to 19 2502.92 .041 .516495 bits 13 to 20 2556.32 .796 .787107
bits 14 to 21 2483.68 .231 .408739 bits 15 to 22 2522.06
.312 .622476 bits 16 to 23 2543.70 .618 .731696 bits 17 to
24 2546.72 .661 .745625 bits 18 to 25 2535.45 .501 .691938
bits 19 to 26 2560.10 .850 .802313 bits 20 to 27 2427.84
1.021 .153734 bits 21 to 28 2591.24 1.290 .901520 bits 22
to 29 2524.49 .346 .635455 bits 23 to 30 2418.28 1.156
.123909 bits 24 to 31 2630.67 1.848 .967694 bits 25 to 32
2474.78 .357 .360670
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: THIS IS A PARKING LOT TEST :: :: In a square of side
100, randomly "park" a cara 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 (k3523)/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 test2 Of 12,000
tries, the average no. of successes should be 3523 with
sigma=21.9 Successes: 3523 zscore: .000 pvalue: .500000
Successes: 3530 zscore: .320 pvalue: .625377 Successes:
3506 zscore: .776 pvalue: .218799 Successes: 3534 zscore:
.502 pvalue: .692266 Successes: 3531 zscore: .365 pvalue:
.642555 Successes: 3522 zscore: .046 pvalue: .481790
Successes: 3535 zscore: .548 pvalue: .708135 Successes:
3537 zscore: .639 pvalue: .738676 Successes: 3551 zscore:
1.279 pvalue: .899470 Successes: 3544 zscore: .959 pvalue:
.831196
square size avg. no. parked sample sigma 100.
3531.300 11.811 KSTEST for the above 10: p= .857477
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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^2n)/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 1exp(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 test2 Sample no. d^2 avg equiv uni 5 1.5700
.8965 .793580 10 .8236 .8487 .562978 15 .2478 .7923
.220484 20 .6932 .9070 .501790 25 .3200 1.0408 .275001
30 .9178 1.0026 .602434 35 .5345 1.0161 .415618 40 .0951
.9276 .091141 45 .3578 .9107 .302048 50 .0422 .9004
.041495 55 .0527 .8899 .051624 60 .0524 .8654 .051309
65 1.2588 .8663 .717803 70 .0685 .8710 .066492 75 1.1848
.8597 .696010 80 .4625 .8643 .371770 85 .5492 .8344
.424163 90 .5521 .8427 .425877 95 .5565 .8500 .428383
100 .3326 .8418 .284108 MINIMUM DISTANCE TEST for test2
Result of KS test on 20 transformed mindist^2's: pvalue=
.621339
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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
1exp(r^3/30.), then a :: :: KSTEST is done on the 20
pvalues. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
The 3DSPHERES test for file test2 sample no: 1 r^3=
1.829 pvalue= .05914 sample no: 2 r^3= 19.172 pvalue=
.47222 sample no: 3 r^3= 85.899 pvalue= .94292 sample no:
4 r^3= 25.478 pvalue= .57227 sample no: 5 r^3= 45.964
pvalue= .78393 sample no: 6 r^3= 10.062 pvalue= .28496
sample no: 7 r^3= 42.853 pvalue= .76031 sample no: 8 r^3=
15.238 pvalue= .39827 sample no: 9 r^3= 7.405 pvalue=
.21874 sample no: 10 r^3= 14.219 pvalue= .37746 sample
no: 11 r^3= 54.344 pvalue= .83658 sample no: 12 r^3= 9.248
pvalue= .26529 sample no: 13 r^3= 4.479 pvalue= .13869
sample no: 14 r^3= 38.643 pvalue= .72421 sample no: 15 r^3=
10.574 pvalue= .29705 sample no: 16 r^3= 26.240 pvalue=
.58300 sample no: 17 r^3= 15.308 pvalue= .39967 sample
no: 18 r^3= 14.764 pvalue= .38868 sample no: 19 r^3= 47.634
pvalue= .79563 sample no: 20 r^3= 17.227 pvalue= .43686
A KS test is applied to those 20 pvalues.

3DSPHERES test for file test2 pvalue= .296908
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 chisquare
test for cell frequencies. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
RESULTS OF SQUEEZE TEST FOR test2 Table of standardized
frequency counts ( (obsexp)/sqrt(exp) )^2 for j taking
values <=6,7,8,...,47,>=48: .6 2.0 1.8 .6 2.5 1.8 .8 .0
1.3 1.0 1.2 .6 .0 .4 .2 .5 1.4 .4 .9 1.4 .1 .1 .2
3.1 .5 .2 .1 .8 .4 .7 .9 .7 .7 .1 .1 .3 2.6
.1 1.3 .7 1.3 1.0 1.1 Chisquare with 42 degrees of
freedom: 53.598 zscore= 1.265 pvalue= .891928
______________________________________________________________
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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
pvalues from ten :: :: KSTESTs are given still another
KSTEST. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Test no. 1 pvalue .594600 Test no. 2 pvalue .180036
Test no. 3 pvalue .002648 Test no. 4 pvalue .588924 Test
no. 5 pvalue .590185 Test no. 6 pvalue .116015 Test no.
7 pvalue .814074 Test no. 8 pvalue .912421 Test no. 9
pvalue .861501 Test no. 10 pvalue .542335 Results of the
OSUM test for test2 KSTEST on the above 10 pvalues: .364078
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 32bit integers in the specified file.
This example :: :: shows how runs are counted:
.123,.357,.789,.425,.224,.416,.95:: :: contains an uprun of
length 3, a downrun of length 2 and an :: :: uprun of (at
least) 2, depending on the next values. The :: :: covariance
matrices for the runsup and runsdown 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 test2 Up and down runs in a
sample of 10000
_________________________________________________ Run test
for test2 : runs up; ks test for 10 p's: .734043 runs
down; ks test for 10 p's: .801918 Run test for test2 :
runs up; ks test for 10 p's: .434815 runs down; ks test for
10 p's: .394612
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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(1p), 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
chisquare test is made on the no.ofthrows cell counts. ::
:: Each 32bit 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 test2 No. of wins: Observed
Expected 98776 98585.86 98776= No. of wins, zscore= .850
pvalue= .80245 Analysis of ThrowsperGame: Chisq= 17.71
for 20 degrees of freedom, p= .39370 Throws Observed Expected
Chisq Sum 1 66689 66666.7 .007 .007 2 37904 37654.3 1.656
1.663 3 26687 26954.7 2.659 4.322 4 19433 19313.5 .740
5.062 5 14023 13851.4 2.125 7.188 6 9755 9943.5 3.575
10.763 7 7235 7145.0 1.133 11.896 8 5039 5139.1 1.949
13.844 9 3683 3699.9 .077 13.921 10 2696 2666.3 .331
14.252 11 1886 1923.3 .724 14.977 12 1384 1388.7 .016
14.993 13 966 1003.7 1.417 16.410 14 717 726.1 .115 16.525
15 513 525.8 .313 16.838 16 386 381.2 .062 16.900 17 278
276.5 .008 16.908 18 196 200.8 .116 17.024 19 141 146.0
.170 17.194 20 99 106.2 .490 17.684 21 290 287.1 .029
17.713 SUMMARY FOR test2 pvalue for no. of wins: .802454
pvalue for throws/game: .393697
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Results of DIEHARD battery of tests sent to file t2.txt
TEST 3 
Entropy source: SRAM CY62177EV30 
NOTE: Most of the tests in DIEHARD return a
pvalue, which should be uniform on [0,1) if the input file
contains truly independent random bits. Those pvalues are
obtained by p=F(X), where F is the assumed distribution of
the sample random variable Xoften 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 pvalues 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 chisquare goodness of fit test :: ::
provides a p value. The first test uses bits 124 (counting ::
:: from the left) from integers in the specified file. ::
:: Then the file is closed and reopened. Next, bits 225 are
:: :: used to provide birthdays, then 326 and so on to bits
932. :: :: Each set of bits provides a pvalue, and the
nine pvalues :: :: provide a sample for a KSTEST. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
BIRTHDAY SPACINGS TEST, M= 512 N=2**24 LAMBDA= 2.0000
Results for test3 For a sample of size 500: mean test3
using bits 1 to 24 2.004 duplicate number number spacings
observed expected 0 72. 67.668 1 135. 135.335 2 122.
135.335 3 103. 90.224 4 41. 45.112 5 14. 18.045 6 to
INF 13. 8.282 Chisquare with 6 d.o.f. = 7.37 pvalue= .712091
::::::::::::::::::::::::::::::::::::::::: For a sample of
size 500: mean test3 using bits 2 to 25 1.964 duplicate
number number spacings observed expected 0 64. 67.668
1 147. 135.335 2 126. 135.335 3 93. 90.224 4 52. 45.112
5 14. 18.045 6 to INF 4. 8.282 Chisquare with 6 d.o.f. =
6.11 pvalue= .588548
::::::::::::::::::::::::::::::::::::::::: For a sample of
size 500: mean test3 using bits 3 to 26 2.008 duplicate
number number spacings observed expected 0 64. 67.668
1 135. 135.335 2 141. 135.335 3 92. 90.224 4 43. 45.112
5 15. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. =
1.44 pvalue= .036668
::::::::::::::::::::::::::::::::::::::::: For a sample of
size 500: mean test3 using bits 4 to 27 1.874 duplicate
number number spacings observed expected 0 85. 67.668
1 120. 135.335 2 144. 135.335 3 94. 90.224 4 44. 45.112
5 8. 18.045 6 to INF 5. 8.282 Chisquare with 6 d.o.f. =
13.81 pvalue= .968160
::::::::::::::::::::::::::::::::::::::::: For a sample of
size 500: mean test3 using bits 5 to 28 2.088 duplicate
number number spacings observed expected 0 52. 67.668
1 133. 135.335 2 153. 135.335 3 90. 90.224 4 39. 45.112
5 22. 18.045 6 to INF 11. 8.282 Chisquare with 6 d.o.f. =
8.56 pvalue= .800209
::::::::::::::::::::::::::::::::::::::::: For a sample of
size 500: mean test3 using bits 6 to 29 2.040 duplicate
number number spacings observed expected 0 71. 67.668
1 113. 135.335 2 150. 135.335 3 89. 90.224 4 53. 45.112
5 17. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. =
7.09 pvalue= .687767
::::::::::::::::::::::::::::::::::::::::: For a sample of
size 500: mean test3 using bits 7 to 30 2.036 duplicate
number number spacings observed expected 0 65. 67.668
1 131. 135.335 2 147. 135.335 3 80. 90.224 4 47. 45.112
5 20. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. =
3.06 pvalue= .198122
::::::::::::::::::::::::::::::::::::::::: For a sample of
size 500: mean test3 using bits 8 to 31 2.116 duplicate
number number spacings observed expected 0 65. 67.668
1 120. 135.335 2 142. 135.335 3 86. 90.224 4 53. 45.112
5 24. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. =
6.07 pvalue= .584606
::::::::::::::::::::::::::::::::::::::::: For a sample of
size 500: mean test3 using bits 9 to 32 2.004 duplicate
number number spacings observed expected 0 58. 67.668
1 144. 135.335 2 148. 135.335 3 74. 90.224 4 45. 45.112
5 26. 18.045 6 to INF 5. 8.282 Chisquare with 6 d.o.f. =
10.85 pvalue= .906756
::::::::::::::::::::::::::::::::::::::::: The 9 pvalues were
.712091 .588548 .036668 .968160 .800209 .687767 .198122
.584606 .906756 A KSTEST for the 9 pvalues yields .613718
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: THE OVERLAPPING 5PERMUTATION TEST :: :: This is the
OPERM5 test. It looks at a sequence of one mill :: :: ion
32bit 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 test3 For a sample of 1,000,000
consecutive 5tuples, chisquare for 99 degrees of freedom=
87.274; pvalue= .205777 OPERM5 test for file test3 For a
sample of 1,000,000 consecutive 5tuples, chisquare for 99
degrees of freedom=129.770; pvalue= .979327
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 test3 Rank test for 31x31 binary
matrices: rows from leftmost 31 bits of each 32bit integer
rank observed expected (oe)^2/e sum 28 212 211.4 .001602
.002 29 5142 5134.0 .012434 .014 30 23125 23103.0 .020860
.035 31 11521 11551.5 .080659 .116 chisquare= .116 for 3
d. of f.; pvalue= .377046

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the BINARY RANK TEST for 32x32 matrices. A random
32x :: :: 32 binary matrix is formed, each row a 32bit
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 test3 Rank test for 32x32 binary
matrices: rows from leftmost 32 bits of each 32bit integer
rank observed expected (oe)^2/e sum 29 220 211.4 .348364
.348 30 5223 5134.0 1.542493 1.891 31 23167 23103.0
.177033 2.068 32 11390 11551.5 2.258588 4.326 chisquare=
4.326 for 3 d. of f.; pvalue= .790462

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the BINARY RANK TEST for 6x8 matrices. From each
of :: :: six random 32bit 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 chisquare test is performed on :: :: counts
for ranks 6,5 and <=4. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Binary Rank Test for test3 Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG test3 brank test for
bits 1 to 8 OBSERVED EXPECTED (OE)^2/E SUM r<=4 960 944.3
.261 .261 r =5 21568 21743.9 1.423 1.684 r =6 77472
77311.8 .332 2.016 p=1exp(SUM/2)= .63503 Rank of a 6x8
binary matrix, rows formed from eight bits of the RNG test3
brank test for bits 2 to 9 OBSERVED EXPECTED (OE)^2/E
SUM r<=4 944 944.3 .000 .000 r =5 21597 21743.9 .992 .993
r =6 77459 77311.8 .280 1.273 p=1exp(SUM/2)= .47080 Rank
of a 6x8 binary matrix, rows formed from eight bits of the
RNG test3 brank test for bits 3 to 10 OBSERVED EXPECTED
(OE)^2/E SUM r<=4 983 944.3 1.586 1.586 r =5 21716
21743.9 .036 1.622 r =6 77301 77311.8 .002 1.623
p=1exp(SUM/2)= .55586 Rank of a 6x8 binary matrix, rows
formed from eight bits of the RNG test3 brank test for bits
4 to 11 OBSERVED EXPECTED (OE)^2/E SUM r<=4 947 944.3
.008 .008 r =5 21954 21743.9 2.030 2.038 r =6 77099
77311.8 .586 2.624 p=1exp(SUM/2)= .73066 Rank of a 6x8
binary matrix, rows formed from eight bits of the RNG test3
brank test for bits 5 to 12 OBSERVED EXPECTED (OE)^2/E
SUM r<=4 933 944.3 .135 .135 r =5 21801 21743.9 .150 .285
r =6 77266 77311.8 .027 .312 p=1exp(SUM/2)= .14458 Rank
of a 6x8 binary matrix, rows formed from eight bits of the
RNG test3 brank test for bits 6 to 13 OBSERVED EXPECTED
(OE)^2/E SUM r<=4 925 944.3 .395 .395 r =5 21879 21743.9
.839 1.234 r =6 77196 77311.8 .173 1.407 p=1exp(SUM/2)=
.50524 Rank of a 6x8 binary matrix, rows formed from eight
bits of the RNG test3 brank test for bits 7 to 14
OBSERVED EXPECTED (OE)^2/E SUM r<=4 945 944.3 .001 .001 r
=5 21766 21743.9 .022 .023 r =6 77289 77311.8 .007 .030
p=1exp(SUM/2)= .01474 Rank of a 6x8 binary matrix, rows
formed from eight bits of the RNG test3 brank test for bits
8 to 15 OBSERVED EXPECTED (OE)^2/E SUM r<=4 953 944.3
.080 .080 r =5 21761 21743.9 .013 .094 r =6 77286 77311.8
.009 .102 p=1exp(SUM/2)= .04981 Rank of a 6x8 binary
matrix, rows formed from eight bits of the RNG test3
brank test for bits 9 to 16 OBSERVED EXPECTED (OE)^2/E SUM
r<=4 933 944.3 .135 .135 r =5 21894 21743.9 1.036 1.171 r
=6 77173 77311.8 .249 1.421 p=1exp(SUM/2)= .50851 Rank
of a 6x8 binary matrix, rows formed from eight bits of the
RNG test3 brank test for bits 10 to 17 OBSERVED EXPECTED
(OE)^2/E SUM r<=4 990 944.3 2.212 2.212 r =5 21812
21743.9 .213 2.425 r =6 77198 77311.8 .168 2.592
p=1exp(SUM/2)= .72642 Rank of a 6x8 binary matrix, rows
formed from eight bits of the RNG test3 brank test for bits
11 to 18 OBSERVED EXPECTED (OE)^2/E SUM r<=4 993 944.3
2.511 2.511 r =5 21751 21743.9 .002 2.514 r =6 77256
77311.8 .040 2.554 p=1exp(SUM/2)= .72113 Rank of a 6x8
binary matrix, rows formed from eight bits of the RNG test3
brank test for bits 12 to 19 OBSERVED EXPECTED (OE)^2/E
SUM r<=4 934 944.3 .112 .112 r =5 21732 21743.9 .007 .119
r =6 77334 77311.8 .006 .125 p=1exp(SUM/2)= .06071 Rank
of a 6x8 binary matrix, rows formed from eight bits of the
RNG test3 brank test for bits 13 to 20 OBSERVED EXPECTED
(OE)^2/E SUM r<=4 941 944.3 .012 .012 r =5 21582 21743.9
1.205 1.217 r =6 77477 77311.8 .353 1.570 p=1exp(SUM/2)=
.54388 Rank of a 6x8 binary matrix, rows formed from eight
bits of the RNG test3 brank test for bits 14 to 21
OBSERVED EXPECTED (OE)^2/E SUM r<=4 968 944.3 .595 .595 r
=5 21804 21743.9 .166 .761 r =6 77228 77311.8 .091 .852
p=1exp(SUM/2)= .34679 Rank of a 6x8 binary matrix, rows
formed from eight bits of the RNG test3 brank test for bits
15 to 22 OBSERVED EXPECTED (OE)^2/E SUM r<=4 993 944.3
2.511 2.511 r =5 21862 21743.9 .641 3.153 r =6 77145
77311.8 .360 3.513 p=1exp(SUM/2)= .82733 Rank of a 6x8
binary matrix, rows formed from eight bits of the RNG test3
brank test for bits 16 to 23 OBSERVED EXPECTED (OE)^2/E
SUM r<=4 993 944.3 2.511 2.511 r =5 21759 21743.9 .010
2.522 r =6 77248 77311.8 .053 2.575 p=1exp(SUM/2)=
.72398 Rank of a 6x8 binary matrix, rows formed from eight
bits of the RNG test3 brank test for bits 17 to 24
OBSERVED EXPECTED (OE)^2/E SUM r<=4 947 944.3 .008 .008 r
=5 21843 21743.9 .452 .459 r =6 77210 77311.8 .134 .593
p=1exp(SUM/2)= .25674 Rank of a 6x8 binary matrix, rows
formed from eight bits of the RNG test3 brank test for bits
18 to 25 OBSERVED EXPECTED (OE)^2/E SUM r<=4 899 944.3
2.173 2.173 r =5 21770 21743.9 .031 2.205 r =6 77331
77311.8 .005 2.209 p=1exp(SUM/2)= .66868 Rank of a 6x8
binary matrix, rows formed from eight bits of the RNG test3
brank test for bits 19 to 26 OBSERVED EXPECTED (OE)^2/E
SUM r<=4 958 944.3 .199 .199 r =5 21619 21743.9 .717 .916
r =6 77423 77311.8 .160 1.076 p=1exp(SUM/2)= .41611 Rank
of a 6x8 binary matrix, rows formed from eight bits of the
RNG test3 brank test for bits 20 to 27 OBSERVED EXPECTED
(OE)^2/E SUM r<=4 968 944.3 .595 .595 r =5 21906 21743.9
1.208 1.803 r =6 77126 77311.8 .447 2.250 p=1exp(SUM/2)=
.67531 Rank of a 6x8 binary matrix, rows formed from eight
bits of the RNG test3 brank test for bits 21 to 28
OBSERVED EXPECTED (OE)^2/E SUM r<=4 1017 944.3 5.597 5.597
r =5 21820 21743.9 .266 5.863 r =6 77163 77311.8 .286 6.150
p=1exp(SUM/2)= .95380 Rank of a 6x8 binary matrix, rows
formed from eight bits of the RNG test3 brank test for bits
22 to 29 OBSERVED EXPECTED (OE)^2/E SUM r<=4 921 944.3
.575 .575 r =5 21981 21743.9 2.585 3.160 r =6 77098
77311.8 .591 3.752 p=1exp(SUM/2)= .84677 Rank of a 6x8
binary matrix, rows formed from eight bits of the RNG test3
brank test for bits 23 to 30 OBSERVED EXPECTED (OE)^2/E
SUM r<=4 971 944.3 .755 .755 r =5 21906 21743.9 1.208
1.963 r =6 77123 77311.8 .461 2.424 p=1exp(SUM/2)=
.70246 Rank of a 6x8 binary matrix, rows formed from eight
bits of the RNG test3 brank test for bits 24 to 31
OBSERVED EXPECTED (OE)^2/E SUM r<=4 990 944.3 2.212 2.212
r =5 21718 21743.9 .031 2.242 r =6 77292 77311.8 .005 2.247
p=1exp(SUM/2)= .67494 Rank of a 6x8 binary matrix, rows
formed from eight bits of the RNG test3 brank test for bits
25 to 32 OBSERVED EXPECTED (OE)^2/E SUM r<=4 982 944.3
1.505 1.505 r =5 21735 21743.9 .004 1.509 r =6 77283
77311.8 .011 1.519 p=1exp(SUM/2)= .53219 TEST SUMMARY,
25 tests on 100,000 random 6x8 matrices These should be 25
uniform [0,1] random variables: .635032 .470804 .555861
.730658 .144584 .505243 .014743 .049812 .508505 .726425
.721134 .060709 .543879 .346790 .827334 .723984 .256742
.668681 .416114 .675307 .953801 .846770 .702457 .674938
.532193 brank test summary for test3 The KS test for
those 25 supposed UNI's yields KS pvalue= .675361
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 20letter ::
:: "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 20letter (20bit) words
in a string of :: :: 2^21 overlapping 20letter 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 :: :: (j141909)/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 20tuples 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: 142206 missing words, .69 sigmas from mean, pvalue=
.75589 tst no 2: 142252 missing words, .80 sigmas from mean,
pvalue= .78833 tst no 3: 142380 missing words, 1.10 sigmas
from mean, pvalue= .86427 tst no 4: 141531 missing words,
.88 sigmas from mean, pvalue= .18836 tst no 5: 142649
missing words, 1.73 sigmas from mean, pvalue= .95802 tst no
6: 141419 missing words, 1.15 sigmas from mean, pvalue= .12597
tst no 7: 141590 missing words, .75 sigmas from mean, pvalue=
.22781 tst no 8: 141460 missing words, 1.05 sigmas from
mean, pvalue= .14690 tst no 9: 142507 missing words, 1.40
sigmas from mean, pvalue= .91871 tst no 10: 141807 missing
words, .24 sigmas from mean, pvalue= .40552 tst no 11:
142606 missing words, 1.63 sigmas from mean, pvalue= .94821
tst no 12: 141377 missing words, 1.24 sigmas from mean,
pvalue= .10679 tst no 13: 141467 missing words, 1.03 sigmas
from mean, pvalue= .15069 tst no 14: 141668 missing words,
.56 sigmas from mean, pvalue= .28643 tst no 15: 142192
missing words, .66 sigmas from mean, pvalue= .74552 tst no
16: 141802 missing words, .25 sigmas from mean, pvalue= .40100
tst no 17: 141616 missing words, .69 sigmas from mean, pvalue=
.24656 tst no 18: 141854 missing words, .13 sigmas from
mean, pvalue= .44857 tst no 19: 141877 missing words, .08
sigmas from mean, pvalue= .46990 tst no 20: 141788 missing
words, .28 sigmas from mean, pvalue= .38841
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: The tests OPSO, OQSO and DNA :: :: OPSO means
OverlappingPairsSparseOccupancy :: :: The OPSO test
considers 2letter words from an alphabet of :: :: 1024
letters. Each letter is determined by a specified ten :: ::
bits from a 32bit integer in the sequence to be tested. OPSO ::
:: generates 2^21 (overlapping) 2letter words (from 2^21+1
:: :: "keystrokes") and counts the number of missing
wordsthat :: :: is 2letter 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 (missingwrds141909)/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 OverlappingQuadruplesSparseOccupancy :: :: The test
OQSO is similar, except that it considers 4letter :: ::
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 32bit 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 10letter 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) 10letter 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 test3 Output: No. missing words
(mw), equiv normal variate (z), pvalue (p) mw z p OPSO
for test3 using bits 23 to 32 142206 1.023 .8468 OPSO for
test3 using bits 22 to 31 141519 1.346 .0892 OPSO for test3
using bits 21 to 30 141949 .137 .5544 OPSO for test3 using
bits 20 to 29 141922 .044 .5174 OPSO for test3 using bits 19
to 28 141464 1.536 .0623 OPSO for test3 using bits 18 to 27
142144 .809 .7908 OPSO for test3 using bits 17 to 26 141522
1.336 .0908 OPSO for test3 using bits 16 to 25 141932 .078
.5312 OPSO for test3 using bits 15 to 24 141703 .711 .2384
OPSO for test3 using bits 14 to 23 141884 .087 .4652 OPSO
for test3 using bits 13 to 22 141530 1.308 .0954 OPSO for
test3 using bits 12 to 21 141804 .363 .3582 OPSO for test3
using bits 11 to 20 142154 .844 .8006 OPSO for test3 using
bits 10 to 19 142280 1.278 .8994 OPSO for test3 using bits 9
to 18 142218 1.064 .8564 OPSO for test3 using bits 8 to 17
142180 .933 .8247 OPSO for test3 using bits 7 to 16 141751
.546 .2925 OPSO for test3 using bits 6 to 15 142307 1.371
.9149 OPSO for test3 using bits 5 to 14 141341 1.960 .0250
OPSO for test3 using bits 4 to 13 141759 .518 .3021 OPSO for
test3 using bits 3 to 12 141027 3.043 .0012 OPSO for test3
using bits 2 to 11 142086 .609 .7288 OPSO for test3 using
bits 1 to 10 142533 2.151 .9842 OQSO test for generator test3
Output: No. missing words (mw), equiv normal variate (z),
pvalue (p) mw z p OQSO for test3 using bits 28 to 32
142197 .975 .8353 OQSO for test3 using bits 27 to 31 141743
.564 .2864 OQSO for test3 using bits 26 to 30 142250 1.155
.8759 OQSO for test3 using bits 25 to 29 142244 1.134 .8717
OQSO for test3 using bits 24 to 28 142062 .518 .6976 OQSO for
test3 using bits 23 to 27 141757 .516 .3028 OQSO for test3
using bits 22 to 26 141630 .947 .1719 OQSO for test3 using
bits 21 to 25 142249 1.151 .8752 OQSO for test3 using bits 20
to 24 142088 .606 .7276 OQSO for test3 using bits 19 to 23
141796 .384 .3504 OQSO for test3 using bits 18 to 22 141863
.157 .4376 OQSO for test3 using bits 17 to 21 141586 1.096
.1365 OQSO for test3 using bits 16 to 20 141748 .547 .2922
OQSO for test3 using bits 15 to 19 141597 1.059 .1449 OQSO
for test3 using bits 14 to 18 141863 .157 .4376 OQSO for
test3 using bits 13 to 17 142098 .640 .7388 OQSO for test3
using bits 12 to 16 142177 .907 .8179 OQSO for test3 using
bits 11 to 15 142430 1.765 .9612 OQSO for test3 using bits 10
to 14 141829 .272 .3927 OQSO for test3 using bits 9 to 13
142503 2.012 .9779 OQSO for test3 using bits 8 to 12 141835
.252 .4005 OQSO for test3 using bits 7 to 11 142167 .873
.8088 OQSO for test3 using bits 6 to 10 142123 .724 .7656
OQSO for test3 using bits 5 to 9 141524 1.306 .0957 OQSO for
test3 using bits 4 to 8 141884 .086 .4658 OQSO for test3
using bits 3 to 7 142066 .531 .7023 OQSO for test3 using bits
2 to 6 141889 .069 .4725 OQSO for test3 using bits 1 to 5
141986 .260 .6025 DNA test for generator test3 Output:
No. missing words (mw), equiv normal variate (z), pvalue (p)
mw z p DNA for test3 using bits 31 to 32 142364 1.341 .9101
DNA for test3 using bits 30 to 31 141706 .600 .2743 DNA for
test3 using bits 29 to 30 141569 1.004 .1577 DNA for test3
using bits 28 to 29 142207 .878 .8101 DNA for test3 using
bits 27 to 28 141640 .794 .2135 DNA for test3 using bits 26
to 27 142015 .312 .6224 DNA for test3 using bits 25 to 26
141386 1.544 .0613 DNA for test3 using bits 24 to 25 141545
1.075 .1413 DNA for test3 using bits 23 to 24 141884 .075
.4702 DNA for test3 using bits 22 to 23 142734 2.433 .9925
DNA for test3 using bits 21 to 22 141782 .376 .3536 DNA for
test3 using bits 20 to 21 142252 1.011 .8440 DNA for test3
using bits 19 to 20 142329 1.238 .8921 DNA for test3 using
bits 18 to 19 141493 1.228 .1097 DNA for test3 using bits 17
to 18 141764 .429 .3341 DNA for test3 using bits 16 to 17
142318 1.206 .8860 DNA for test3 using bits 15 to 16 142065
.459 .6770 DNA for test3 using bits 14 to 15 141855 .160
.4363 DNA for test3 using bits 13 to 14 142042 .391 .6522
DNA for test3 using bits 12 to 13 142169 .766 .7782 DNA for
test3 using bits 11 to 12 141929 .058 .5231 DNA for test3
using bits 10 to 11 141374 1.579 .0572 DNA for test3 using
bits 9 to 10 141955 .135 .5536 DNA for test3 using bits 8 to
9 141356 1.632 .0513 DNA for test3 using bits 7 to 8 141824
.252 .4006 DNA for test3 using bits 6 to 7 142310 1.182
.8814 DNA for test3 using bits 5 to 6 141692 .641 .2607
DNA for test3 using bits 4 to 5 141942 .096 .5384 DNA for
test3 using bits 3 to 4 142680 2.273 .9885 DNA for test3
using bits 2 to 3 142048 .409 .6588 DNA for test3 using bits
1 to 2 141487 1.246 .1064
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the COUNTTHE1'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 5letter :: :: 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 5letter words, and from a string of
256,000 (over :: :: lapping) 5letter 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:: Q5Q4, the
difference of the naive Pearson sums of :: ::
(OBSEXP)^2/EXP on counts for 5 and 4letter cell counts. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Test results for test3 Chisquare with 5^55^4=2500 d.of
f. for sample size:2560000 chisquare equiv normal pvalue
Results fo COUNTTHE1's in successive bytes: byte stream for
test3 2456.45 .616 .268965 byte stream for test3 2533.89
.479 .684111
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the COUNTTHE1's TEST for specific bytes. ::
:: Consider the file under test as a stream of 32bit 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) 5letter
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
5letter words, and :: :: from a string of 256,000
(overlapping) 5letter 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:: Q5Q4, the difference of ::
:: the naive Pearson sums of (OBSEXP)^2/EXP on counts for
5 :: :: and 4letter cell counts. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Chisquare with 5^55^4=2500 d.of f. for sample size: 256000
chisquare equiv normal p value Results for COUNTTHE1's in
specified bytes: bits 1 to 8 2477.71 .315 .376278 bits 2
to 9 2525.62 .362 .641422 bits 3 to 10 2485.85 .200 .420702
bits 4 to 11 2549.86 .705 .759624 bits 5 to 12 2534.42 .487
.686809 bits 6 to 13 2496.46 .050 .480063 bits 7 to 14
2585.96 1.216 .887950 bits 8 to 15 2358.91 1.995 .023007
bits 9 to 16 2512.44 .176 .569849 bits 10 to 17 2426.54
1.039 .149435 bits 11 to 18 2554.88 .776 .781162 bits 12
to 19 2396.97 1.457 .072555 bits 13 to 20 2655.00 2.192
.985809 bits 14 to 21 2523.04 .326 .627704 bits 15 to 22
2578.38 1.109 .866181 bits 16 to 23 2586.25 1.220 .888725
bits 17 to 24 2549.18 .696 .756649 bits 18 to 25 2552.58 .744
.771425 bits 19 to 26 2558.83 .832 .797289 bits 20 to 27
2617.87 1.667 .952241 bits 21 to 28 2578.85 1.115 .867609
bits 22 to 29 2512.09 .171 .567892 bits 23 to 30 2511.25 .159
.563178 bits 24 to 31 2504.01 .057 .522637 bits 25 to 32
2484.70 .216 .414342
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: THIS IS A PARKING LOT TEST :: :: In a square of side
100, randomly "park" a cara 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 (k3523)/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 test3 Of 12,000
tries, the average no. of successes should be 3523 with
sigma=21.9 Successes: 3510 zscore: .594 pvalue: .276387
Successes: 3482 zscore: 1.872 pvalue: .030593 Successes:
3505 zscore: .822 pvalue: .205562 Successes: 3547 zscore:
1.096 pvalue: .863437 Successes: 3525 zscore: .091 pvalue:
.536382 Successes: 3523 zscore: .000 pvalue: .500000
Successes: 3501 zscore: 1.005 pvalue: .157553 Successes:
3529 zscore: .274 pvalue: .607947 Successes: 3522 zscore:
.046 pvalue: .481790 Successes: 3496 zscore: 1.233
pvalue: .108811
square size avg. no. parked sample sigma
100. 3514.000 17.866 KSTEST for the above 10: p= .679832
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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^2n)/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 1exp(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 test3 Sample no. d^2 avg equiv uni 5 .0632
.3650 .061586 10 .3836 .4171 .319888 15 .5267 .5140
.411016 20 1.1033 .6271 .670070 25 .0213 .6262 .021185
30 1.1779 .6922 .693902 35 .6951 .8446 .502730 40 .3488
.8748 .295703 45 2.8859 1.0273 .944998 50 1.7469 1.0468
.827215 55 .0148 1.0692 .014813 60 .0643 1.0348 .062551
65 2.3781 1.0475 .908371 70 3.7897 1.0440 .977824 75 .3471
1.0123 .294499 80 2.8361 1.0028 .942174 85 1.7446 .9758
.826807 90 2.1385 .9824 .883432 95 .0485 .9420 .047623
100 .6420 .9372 .475462 MINIMUM DISTANCE TEST for test3
Result of KS test on 20 transformed mindist^2's: pvalue=
.819181
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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
1exp(r^3/30.), then a :: :: KSTEST is done on the 20
pvalues. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
The 3DSPHERES test for file test3 sample no: 1 r^3=
42.722 pvalue= .75926 sample no: 2 r^3= 11.005 pvalue=
.30708 sample no: 3 r^3= 27.425 pvalue= .59915 sample no:
4 r^3= 1.494 pvalue= .04859 sample no: 5 r^3= 139.928
pvalue= .99057 sample no: 6 r^3= 38.329 pvalue= .72131
sample no: 7 r^3= 8.875 pvalue= .25609 sample no: 8 r^3=
2.849 pvalue= .09060 sample no: 9 r^3= .667 pvalue= .02198
sample no: 10 r^3= 15.606 pvalue= .40561 sample no: 11 r^3=
44.121 pvalue= .77023 sample no: 12 r^3= 68.041 pvalue=
.89649 sample no: 13 r^3= 46.759 pvalue= .78958 sample
no: 14 r^3= 100.402 pvalue= .96480 sample no: 15 r^3= 15.220
pvalue= .39790 sample no: 16 r^3= 55.755 pvalue= .84409
sample no: 17 r^3= 11.275 pvalue= .31328 sample no: 18 r^3=
73.755 pvalue= .91444 sample no: 19 r^3= 126.098 pvalue=
.98505 sample no: 20 r^3= 44.547 pvalue= .77348 A KS test
is applied to those 20 pvalues.

3DSPHERES test for file test3 pvalue= .878239
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 chisquare
test for cell frequencies. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
RESULTS OF SQUEEZE TEST FOR test3 Table of standardized
frequency counts ( (obsexp)/sqrt(exp) )^2 for j taking
values <=6,7,8,...,47,>=48: .8 .7 1.1 .2 .9 1.3 .8 .6
1.4 .0 .3 .9 .7 .9 .8 .0 1.1 1.4 .7 .5 .2 1.9 1.3
.5 .1 1.9 .3 1.6 1.8 1.4 .6 .1 .4 .5 .1 1.6 .5
.2 .1 1.0 1.3 .0 1.1 Chisquare with 42 degrees of
freedom: 38.989 zscore= .329 pvalue= .395903
______________________________________________________________
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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
pvalues from ten :: :: KSTESTs are given still another
KSTEST. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Test no. 1 pvalue .516390 Test no. 2 pvalue .248179
Test no. 3 pvalue .230872 Test no. 4 pvalue .227177 Test
no. 5 pvalue .599579 Test no. 6 pvalue .710847 Test no.
7 pvalue .571424 Test no. 8 pvalue .285338 Test no. 9
pvalue .079077 Test no. 10 pvalue .636207 Results of the
OSUM test for test3 KSTEST on the above 10 pvalues: .660794
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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 32bit integers in the specified file.
This example :: :: shows how runs are counted:
.123,.357,.789,.425,.224,.416,.95:: :: contains an uprun of
length 3, a downrun of length 2 and an :: :: uprun of (at
least) 2, depending on the next values. The :: :: covariance
matrices for the runsup and runsdown 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 test3 Up and down runs in a
sample of 10000
_________________________________________________ Run test
for test3 : runs up; ks test for 10 p's: .872171 runs
down; ks test for 10 p's: .650265 Run test for test3 :
runs up; ks test for 10 p's: .540054 runs down; ks test for
10 p's: .733981
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 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(1p), 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
chisquare test is made on the no.ofthrows cell counts. ::
:: Each 32bit 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 test3 No. of wins: Observed
Expected 98573 98585.86 98573= No. of wins, zscore= .058
pvalue= .47707 Analysis of ThrowsperGame: Chisq= 21.02
for 20 degrees of freedom, p= .60427 Throws Observed Expected
Chisq Sum 1 66634 66666.7 .016 .016 2 37722 37654.3 .122
.138 3 27250 26954.7 3.234 3.372 4 19063 19313.5 3.248
6.620 5 13772 13851.4 .455 7.075 6 9898 9943.5 .209 7.284
7 7090 7145.0 .424 7.708 8 5133 5139.1 .007 7.715 9 3740
3699.9 .435 8.150 10 2694 2666.3 .288 8.438 11 1966 1923.3
.947 9.385 12 1389 1388.7 .000 9.385 13 1024 1003.7 .410
9.795 14 791 726.1 5.793 15.588 15 489 525.8 2.580 18.169
16 365 381.2 .684 18.853 17 258 276.5 1.243 20.096 18 191
200.8 .481 20.577 19 138 146.0 .437 21.014 20 107 106.2
.006 21.020 21 286 287.1 .004 21.024 SUMMARY FOR test3
pvalue for no. of wins: .477068 pvalue for throws/game:
.604271
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$


