NOTE
Most of the tests in DIEHARD return a p-value, which
should be uniform on [0,1) if the input file contains truly
independent random bits. Those p-values are obtained by
p=F(X), where F is the assumed distribution of the sample
random variable X---often normal. But that assumed F is often
just an approximation, for which the fit will likely be worst
in the tails. Thus you should not be surprised with occasion-
al p-values near 0 or 1, such as .0012 or .9983. When a bit
stream really FAILS BIG, you will get p`s of 0 or 1 to six
or more places. By all means, do not, as a Statistician
might, think that a p < .025 or p> .975 means that the RNG
has "failed the test at the .05 level". Such p`s happen
among the hundreds that DIEHARD produces, even with good RNGs.
So keep in mind that "p happens"
Enter the name of the file to be tested.
This must be a form="unformatted",access="direct" binary
file of about 10-12 million bytes.
Enter file name:
Which tests do you want to perform?
For all tests, enter 17 1's:
11111111111111111:
To choose, say, tests 1, 3, 7, 14 enter:
10100010000001000:
HERE ARE YOUR CHOICES:
1 Birthday Spacings
2 GCD
3 Gorilla
4 Overlapping Permutations
5 Ranks of 31x31 and 32x32 matrices
6 Ranks of 6x8 Matrices
7 Monkey Tests on 20-bit Words
8 Monkey Tests OPSO,OQSO,DNA
9 Count the 1`s in a Stream of Bytes
10 Count the 1`s in Specific Bytes
11 Parking Lot Test
12 Minimum Distance Test
13 Random Spheres Test
14 The Sqeeze Test
15 Overlapping Sums Test
16 Runs Up and Down Test
17 The Craps Test
Enter your choices, 1's yes, 0's no using 17 columns:
12345678901234567
|-------------------------------------------------------------|
| This is the BIRTHDAY SPACINGS TEST |
|Choose m birthdays in a "year" of n days. List the spacings |
|between the birthdays. Let j be 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^10, so that the underlying distribution for j |
|is taken to be Poisson with lambda=2^30/(2^26)=16. A sample |
|of 200 j's is taken, and a chi-square goodness of fit test |
|provides a p value. The first test uses bits 1-24 (counting |
|from the left) from 32-bit integers in the specified file. |
|The file is closed and reopened, then bits 2-25 of the same |
|integers are used to provide birthdays, and so on to bits |
|9-32. Each set of bits provides a p-value, and the nine p- |
|values provide a sample for a KSTEST. |
|------------------------------------------------------------ |
RESULTS OF BIRTHDAY SPACINGS FOR urandom.bin
(no_bdays=1024, no_days/yr=2^24, lambda=16.00, sample size=500)
Bits used mean chisqr p-value
1 to 24 69.57 21905.9731 1.000000
2 to 25 68.94 21905.9731 1.000000
3 to 26 55.48 21905.9731 1.000000
4 to 27 52.94 21905.9731 1.000000
5 to 28 53.68 21905.9731 1.000000
6 to 29 54.15 21905.9731 1.000000
7 to 30 57.90 21905.9731 1.000000
8 to 31 63.21 21905.9731 1.000000
9 to 32 68.99 21905.9731 1.000000
Chisquare degrees of freedom: 17
---------------------------------------------------------------
p-value for KStest on those 9 p-values: 0.000000
|-------------------------------------------------------------|
| This is the "tough" BIRTHDAY SPACINGS TEST |
|Choose 4096 birthdays in a "year" of 2^32 days. Thus each |
|birthday is a 32-bit integer and the test uses 2^12 of them, |
|so that j, the number of duplicate spacings, is asympotically|
|Poisson distributed with lambda=4 . Generators that pass the|
|earlier tests for m=1024 and n=2^24 often fail this test, yet|
|those that pass this test seem to pass the "weaker" test. |
|Each set of 4096 birthdays provide a Poisson variate j, and |
|500 such j's lead to a chisquare test to see if the result |
|is consistent with the Poisson distribution with lambda=16. |
|------------------------------------------------------------ |
Tough bday spacings test for urandom.bin: 4096 birthdays, year=2^32 days
Table of Expected vs. Observed counts:
Duplicates 0 1 2 3 4 5 6 7 8 9 >=10
Expected 9.2 36.6 73.3 97.7 97.7 78.1 52.1 29.8 14.9 6.6 4.1
Observed 0 0 0 0 0 0 0 0 0 0 500
(O-E)^2/E 9.2 36.6 73.3 97.7 97.7 78.1 52.1 29.8 14.9 6.660487.7
Birthday Spacings: Sum(O-E)^2/E=60983.660, p= 1.000
|-----------------------------------------------------------|
|This is the GCD TEST. Let the (32-bit) RNG produce two |
|successive integers u,v. Use Euclids algorithm to find the|
|gcd, say x, of u and v. Let k be the number of steps needed|
|to get x. Then k is approximately binomial with p=.376 |
|and n=50, while the distribution of x is very close to |
| Pr(x=i)=c/i^2, with c=6/pi^2. The gcd test uses ten |
|million such pairs u,v to see if the resulting frequencies |
|of k's and x's are consistent with the above distributions.|
|Congruential RNG's---even those with prime modulus---fail |
|this test for the distribution of k, the number of steps, |
|and often for the distribution of gcd values x as well. |
|-----------------------------------------------------------|
RESULTS OF GCD FOR urandom.bin
Not enough random numbers for this test. Minimum is 20000000. The test is skipped.
|-----------------------------------------------------------|
|This is the GORILLA test, a strong version of the monkey |
|tests that I developed in the 70's. It concerns strings |
|formed from specified bits in 32-bit integers from the RNG.|
|We specify the bit position to be studied, from 0 to 31, |
|say bit 3. Then we generate 67,108,889 (2^26+25) numbers |
|from the generator and form a string of 2^26+25 bits by |
|taking bit 3 from each of those numbers. In that string of |
|2^26+25 bits we count the number of 26-bit segments that |
|do not appear. That count should be approximately normal |
|with mean 24687971 and std. deviation 4170. This leads to |
|a normal z-score and hence to a p-value. The test is |
|applied for each bit position 0 (leftmost) to 31. |
|(Some older tests use Fortran's 1-32 for most- to least- |
|significant bits. Gorilla and newer tests use C's 0 to 31.)|
|-----------------------------------------------------------|
Gorilla test for 2^26 bits, positions 0 to 31 for urandom.bin:
Note: lengthy test---for example, ~20 minutes for 850MHz PC
Not enough random numbers for this test. Minimum is 67108889. The test is skipped.
|-------------------------------------------------------------|
| THE OVERLAPPING 5-PERMUTATION TEST |
|This is the OPERM5 test. It looks at a sequence of ten mill-|
|ion 32-bit random integers. Each set of five consecutive |
|integers can be in one of 120 states, for the 5! possible or-|
|derings of five numbers. Thus the 5th, 6th, 7th,...numbers |
|each provide a state. As many thousands of state transitions |
|are observed, cumulative counts are made of the number of |
|occurences of each state. Then the quadratic form in the |
|weak inverse of the 120x120 covariance matrix yields a test |
|that the 120 cellcounts came from the specified (asymptotic) |
|distribution with the specified means and 120x120 covariance.|
|-------------------------------------------------------------|
The OPERM5 test for 10 million (overlapping) 5-tuples for urandom.bin,
p-values for 5 runs:
Not enough random numbers for this test. Minimum is 50000025. The test is skipped.
|-------------------------------------------------------------|
|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 chisqu-|
|are test is performed on counts for ranks 31,30,28 and <=28. |
| (The 31x31 choice is based on the unjustified popularity of |
| the proposed "industry standard" generator |
| x(n) = 16807*x(n-1) mod 2^31-1, not a very good one.) |
|-------------------------------------------------------------|
Rank test for binary matrices (31x31) for urandom.bin
RANK OBSERVED EXPECTED (O-E)^2/E SUM
r<=28 37949 211.4 6736063.347 6736063.347
r= 29 1947 5134.0 1978.382 6738041.730
r= 30 102 23103.0 22899.498 6760941.227
r= 31 2 11551.5 11547.524 6772488.752
chi-square = 6772488.752 with df = 3; p-value = 1.000
--------------------------------------------------------------
|-------------------------------------------------------------|
|This is the BINARY RANK TEST for 32x32 matrices. A random 32x|
|32 binary matrix is formed, each row a 32-bit random integer.|
|The rank is determined. That rank can be from 0 to 32. Ranks |
|less than 29 are rare, and their counts are pooled with those|
|for rank 29. Ranks are found for 40,000 such random matrices|
|and a chisquare test is performed on counts for ranks 32,31,|
|30 and <=29. |
|-------------------------------------------------------------|
Rank test for binary matrices (32x32) for urandom.bin
RANK OBSERVED EXPECTED (O-E)^2/E SUM
r<=29 37843 211.4 6698275.027 6698275.027
r= 30 2025 5134.0 1882.728 6700157.755
r= 31 129 23103.0 22845.768 6723003.523
r= 32 3 11551.5 11545.525 6734549.048
chi-square = 6734549.048 with df = 3; p-value = 1.000
--------------------------------------------------------------
|-------------------------------------------------------------|
|This is the BINARY RANK TEST for 6x8 matrices. From each of |
|six random 32-bit integers from the generator under test, a |
|specified byte is chosen, and the resulting six bytes form a |
|6x8 binary matrix whose rank is determined. That rank can be|
|from 0 to 6, but ranks 0,1,2,3 are rare; their counts are |
|pooled with those for rank 4. Ranks are found for 100,000 |
|random matrices, and a chi-square test is performed on |
|counts for ranks <=4, 5 and 6. |
|-------------------------------------------------------------|
Rank test for binary matrices (6x8) for urandom.bin
b-rank test for bits 1 to 8, p=1.00000
b-rank test for bits 2 to 9, p=1.00000
b-rank test for bits 3 to 10, p=1.00000
b-rank test for bits 4 to 11, p=1.00000
b-rank test for bits 5 to 12, p=1.00000
b-rank test for bits 6 to 13, p=1.00000
b-rank test for bits 7 to 14, p=1.00000
b-rank test for bits 8 to 15, p=1.00000
b-rank test for bits 9 to 16, p=1.00000
b-rank test for bits 10 to 17, p=1.00000
b-rank test for bits 11 to 18, p=1.00000
b-rank test for bits 12 to 19, p=1.00000
b-rank test for bits 13 to 20, p=1.00000
b-rank test for bits 14 to 21, p=1.00000
b-rank test for bits 15 to 22, p=1.00000
b-rank test for bits 16 to 23, p=1.00000
b-rank test for bits 17 to 24, p=1.00000
b-rank test for bits 18 to 25, p=1.00000
b-rank test for bits 19 to 26, p=1.00000
b-rank test for bits 20 to 27, p=1.00000
b-rank test for bits 21 to 28, p=1.00000
b-rank test for bits 22 to 29, p=1.00000
b-rank test for bits 23 to 30, p=1.00000
b-rank test for bits 24 to 31, p=1.00000
b-rank test for bits 25 to 32, p=1.00000
TEST SUMMARY, 25 tests, each on 100,000 random 6x8 matrices
The above should be 25 uniform [0,1] random variables:
The KS test for those 25 supposed UNI's yields p = 0.000000
|-------------------------------------------------------------|
| THE BITSTREAM TEST |
|The file under test is viewed as a stream of bits. Call them |
|b1,b2,... . Consider an alphabet with two "letters", 0 and 1|
|and think of the stream of bits as a succession of 20-letter |
|"words", overlapping. Thus the first word is b1b2...b20, the|
|second is b2b3...b21, and so on. The bitstream test counts |
|the number of missing 20-letter (20-bit) words in a string of|
|2^21 overlapping 20-letter words. There are 2^20 possible 20|
|letter words. For a truly random string of 2^21+19 bits, the|
|number of missing words j should be (very close to) normally |
|distributed with mean 141,909 and sigma 428. Thus |
| (j-141909)/428 should be a standard normal variate (z score)|
|that leads to a uniform [0,1) p value. The test is repeated |
|twenty times. |
|-------------------------------------------------------------|
THE OVERLAPPING 20-TUPLES BITSTREAM TEST for urandom.bin
(20 bits/word, 2097152 words 20 bitstreams. No. missing words
should average 141909.33 with sigma=428.00.)
----------------------------------------------------------------
BITSTREAM test results.
Bitstream No. missing words z-score p-value
1 331719 443.48 1.000000
2 331066 441.95 1.000000
3 331775 443.61 1.000000
4 332808 446.02 1.000000
5 331337 442.59 1.000000
6 332472 445.24 1.000000
7 330704 441.11 1.000000
8 331201 442.27 1.000000
9 330214 439.96 1.000000
10 330820 441.38 1.000000
11 332314 444.87 1.000000
12 331405 442.75 1.000000
13 331855 443.80 1.000000
14 332006 444.15 1.000000
15 331248 442.38 1.000000
16 331019 441.85 1.000000
17 331285 442.47 1.000000
18 330756 441.23 1.000000
19 331906 443.92 1.000000
20 331628 443.27 1.000000
----------------------------------------------------------------
|-------------------------------------------------------------|
| OPSO means Overlapping-Pairs-Sparse-Occupancy |
|The OPSO test considers 2-letter words from an alphabet of |
|1024 letters. Each letter is determined by a specified ten |
|bits from a 32-bit integer in the sequence to be tested. OPSO|
|generates 2^21 (overlapping) 2-letter words (from 2^21+1 |
|"keystrokes") and counts the number of missing words---that |
|is,2-letter words which do not appear in the entire sequence.|
|That count should be very close to normally distributed with |
|mean 141,909, sigma 290. Thus (missingwrds-141909)/290 should|
|be a standard normal variable. The OPSO test takes 32 bits at|
|a time from the test file and uses a designated set of ten |
|consecutive bits. It then restarts the file for the next de- |
|signated 10 bits, and so on. |
|------------------------------------------------------------ |
OPSO test for urandom.bin
Bits used No. missing words z-score p-value
23 to 32 782551 2209.1092 1.000000
22 to 31 779480 2198.5196 1.000000
21 to 30 776242 2187.3540 1.000000
20 to 29 773756 2178.7816 1.000000
19 to 28 772183 2173.3575 1.000000
18 to 27 771347 2170.4747 1.000000
17 to 26 967704 2847.5678 1.000000
16 to 25 966798 2844.4437 1.000000
15 to 24 782561 2209.1437 1.000000
14 to 23 779399 2198.2402 1.000000
13 to 22 776141 2187.0058 1.000000
12 to 21 773540 2178.0368 1.000000
11 to 20 771883 2172.3230 1.000000
10 to 19 770980 2169.2092 1.000000
9 to 18 967357 2846.3713 1.000000
8 to 17 966452 2843.2506 1.000000
7 to 16 782542 2209.0782 1.000000
6 to 15 779383 2198.1851 1.000000
5 to 14 776110 2186.8989 1.000000
4 to 13 773493 2177.8747 1.000000
3 to 12 771796 2172.0230 1.000000
2 to 11 770904 2168.9471 1.000000
1 to 10 967323 2846.2540 1.000000
-----------------------------------------------------------------
|------------------------------------------------------------ |
| OQSO means Overlapping-Quadruples-Sparse-Occupancy |
| The test OQSO is similar, except that it considers 4-letter|
|words from an alphabet of 32 letters, each letter determined |
|by a designated string of 5 consecutive bits from the test |
|file, elements of which are assumed 32-bit random integers. |
|The mean number of missing words in a sequence of 2^21 four- |
|letter words, (2^21+3 "keystrokes"), is again 141909, with |
|sigma = 295. The mean is based on theory; sigma comes from |
|extensive simulation. |
|------------------------------------------------------------ |
OQSO test for urandom.bin
Bits used No. missing words z-score p-value
28 to 32 141740 -0.5740 0.282984
27 to 31 141998 0.3006 0.618131
26 to 30 142039 0.4396 0.669872
25 to 29 968837 2803.1446 1.000000
24 to 28 962445 2781.4768 1.000000
23 to 27 957586 2765.0057 1.000000
22 to 26 954482 2754.4836 1.000000
21 to 25 952775 2748.6972 1.000000
20 to 24 142034 0.4226 0.663710
19 to 23 141905 -0.0147 0.494145
18 to 22 141003 -3.0723 0.001062
17 to 21 968719 2802.7446 1.000000
16 to 20 962110 2780.3413 1.000000
15 to 19 957024 2763.1006 1.000000
14 to 18 953898 2752.5040 1.000000
13 to 17 952057 2746.2633 1.000000
12 to 16 141525 -1.3028 0.096319
11 to 15 141978 0.2328 0.592034
10 to 14 141968 0.1989 0.578822
9 to 13 968691 2802.6497 1.000000
8 to 12 962051 2780.1413 1.000000
7 to 11 956952 2762.8565 1.000000
6 to 10 953586 2751.4463 1.000000
5 to 9 951805 2745.4091 1.000000
4 to 8 141453 -1.5469 0.060946
3 to 7 142210 1.0192 0.845951
2 to 6 142143 0.7921 0.785849
1 to 5 968750 2802.8497 1.000000
-----------------------------------------------------------------
|------------------------------------------------------------ |
| The DNA test considers an alphabet of 4 letters: C,G,A,T,|
|determined by two designated bits in the sequence of random |
|integers being tested. It considers 10-letter words, so that|
|as in OPSO and OQSO, there are 2^20 possible words, and the |
|mean number of missing words from a string of 2^21 (over- |
|lapping) 10-letter words (2^21+9 "keystrokes") is 141909. |
|The standard deviation sigma=339 was determined as for OQSO |
|by simulation. (Sigma for OPSO, 290, is the true value (to |
|three places), not determined by simulation. |
|------------------------------------------------------------ |
DNA test for urandom.bin
Bits used No. missing words z-score p-value
31 to 32 141644 -0.7827 0.216906
30 to 31 141784 -0.3697 0.355801
29 to 30 142333 1.2498 0.894307
28 to 29 141250 -1.9449 0.025892
27 to 28 141874 -0.1042 0.458498
26 to 27 141503 -1.1986 0.115339
25 to 26 1041026 2652.2616 1.000000
24 to 25 1035843 2636.9725 1.000000
23 to 24 142136 0.6686 0.748138
22 to 23 141565 -1.0157 0.154881
21 to 22 142338 1.2645 0.896977
20 to 21 141843 -0.1957 0.422437
19 to 20 142371 1.3619 0.913379
18 to 19 142398 1.4415 0.925279
17 to 18 1041095 2652.4651 1.000000
16 to 17 1035922 2637.2055 1.000000
15 to 16 142102 0.5683 0.715101
14 to 15 141813 -0.2842 0.388144
13 to 14 141582 -0.9656 0.167128
12 to 13 142330 1.2409 0.892681
11 to 12 142003 0.2763 0.608846
10 to 11 141709 -0.5909 0.277279
9 to 10 1041087 2652.4415 1.000000
8 to 9 1035903 2637.1495 1.000000
7 to 8 141427 -1.4228 0.077397
6 to 7 142447 1.5860 0.943636
5 to 6 141912 0.0079 0.503142
4 to 5 142093 0.5418 0.706022
3 to 4 141290 -1.8269 0.033855
2 to 3 141497 -1.2163 0.111933
1 to 2 1041176 2652.7040 1.000000
-----------------------------------------------------------------
|-------------------------------------------------------------|
| This is the COUNT-THE-1's TEST on a stream of bytes. |
|Consider the file under test as a stream of bytes (four per |
|32 bit integer). Each byte can contain from 0 to 8 1's |
|with probabilities 1,8,28,56,70,56,28,8,1 over 256. Now let |
|the stream of bytes provide a string of overlapping 5-letter|
|words, each "letter" taking values A,B,C,D,E. The letters are|
|determined by the number of 1's in a byte: 0,1,or 2 yield A |
|3 yields B, 4 yields C, 5 yields D and 6,7 or 8 yield E. Thus|
|we have a monkey at a typewriter hitting five keys with vari-|
|ous probabilities (37,56,70,56,37 over 256). There are 5^5 |
|possible 5-letter words, and from a string of 256,000 (over- |
|lapping) 5-letter words, counts are made on the frequencies |
|for each word. The quadratic form in the weak inverse of |
|the covariance matrix of the cell counts provides a chisquare|
|test: Q5-Q4, the difference of the naive Pearson sums of |
|(OBS-EXP)^2/EXP on counts for 5- and 4-letter cell counts. |
|-------------------------------------------------------------|
Test result COUNT-THE-1's in bytes for urandom.bin
(Degrees of freedom: 5^4-5^3=2500; sample size: 2560000)
chisquare z-score p-value
489020.14 6880.434 1.000000
|-------------------------------------------------------------|
| This is the COUNT-THE-1's TEST for specific bytes. |
|Consider the file under test as a stream of 32-bit integers. |
|From each integer, a specific byte is chosen , say the left- |
|most: bits 1 to 8. Each byte can contain from 0 to 8 1's, |
|with probabilitie 1,8,28,56,70,56,28,8,1 over 256. Now let |
|the specified bytes from successive integers provide a string|
|of (overlapping) 5-letter words, each "letter" taking values|
|A,B,C,D,E. The letters are determined by the number of 1's, |
|in that byte: 0,1,or 2 ---> A, 3 ---> B, 4 ---> C, 5 ---> D, |
|and 6,7 or 8 ---> E. Thus we have a monkey at a typewriter |
|hitting five keys with with various probabilities: 37,56,70, |
|56,37 over 256. There are 5^5 possible 5-letter words, and |
|from a string of 256,000 (overlapping) 5-letter words, counts|
|are made on the frequencies for each word. The quadratic form|
|in the weak inverse of the covariance matrix of the cell |
|counts provides a chisquare test: Q5-Q4, the difference of |
|the naive Pearson sums of (OBS-EXP)^2/EXP on counts for 5- |
|and 4-letter cell counts. |
|-------------------------------------------------------------|
Test results for specific bytes for urandom.bin
(Degrees of freedom: 5^4-5^3=2500; sample size: 256000)
bits used chisquare z-score p-value
1 to 8 50139.38 673.723 1.000000
2 to 9 49012.64 657.788 1.000000
3 to 10 50039.96 672.317 1.000000
4 to 11 50477.42 678.503 1.000000
5 to 12 51328.08 690.533 1.000000
6 to 13 50942.96 685.087 1.000000
7 to 14 51159.82 688.154 1.000000
8 to 15 51461.14 692.415 1.000000
9 to 16 51319.51 690.412 1.000000
10 to 17 50256.26 675.376 1.000000
11 to 18 50677.69 681.335 1.000000
12 to 19 51329.76 690.557 1.000000
13 to 20 50756.97 682.457 1.000000
14 to 21 51173.42 688.346 1.000000
15 to 22 51938.16 699.161 1.000000
16 to 23 52790.63 711.217 1.000000
17 to 24 52278.46 703.974 1.000000
18 to 25 51208.38 688.840 1.000000
19 to 26 50328.49 676.397 1.000000
20 to 27 50271.32 675.588 1.000000
21 to 28 50807.55 683.172 1.000000
22 to 29 51241.84 689.314 1.000000
23 to 30 51098.71 687.290 1.000000
24 to 31 51362.88 691.025 1.000000
25 to 32 51231.67 689.170 1.000000
|-------------------------------------------------------------|
| THIS IS A PARKING LOT TEST |
|In a square of side 100, randomly "park" a car---a circle of |
|radius 1. Then try to park a 2nd, a 3rd, and so on, each |
|time parking "by ear". That is, if an attempt to park a car |
|causes a crash with one already parked, try again at a new |
|random location. (To avoid path problems, consider parking |
|helicopters rather than cars.) Each attempt leads to either|
|a crash or a success, the latter followed by an increment to |
|the list of cars already parked. If we plot n: the number of |
|attempts, versus k: the number successfully parked, we get a |
|curve that should be similar to those provided by a perfect |
|random number generator. Theory for the behavior of such a |
|random curve seems beyond reach, and as graphics displays are|
|not available for this battery of tests, a simple characteriz|
|ation of the random experiment is used: k, the number of cars|
|successfully parked after n=12,000 attempts. Simulation shows|
|that k should average 3523 with sigma 21.9 and be approximate|
|to normally distributed. Thus (k-3523)/21.9 should serve as |
|a standard normal variable, which, converted to a p uniform |
|in [0,1), provides input to a KSTEST based on a sample of 10.|
|-------------------------------------------------------------|
CDPARK for urandom.bin: result of 10 tests
(Of 12000 tries, the average no. of successes should be
3523.0 with sigma=21.9)
No. succeses z-score p-value
1178 -107.0776 0.000000
1186 -106.7123 0.000000
1173 -107.3059 0.000000
1187 -106.6667 0.000000
1197 -106.2100 0.000000
1178 -107.0776 0.000000
1195 -106.3014 0.000000
1186 -106.7123 0.000000
1163 -107.7626 0.000000
1184 -106.8037 0.000000
Square side=100, avg. no. parked=1182.70 sample std.=9.61
p-value of the KSTEST for those 10 p-values: 0.000000
|-------------------------------------------------------------|
| THE MINIMUM DISTANCE TEST |
|It does this ten times: choose n=8000 random points in a |
|square of side 10000. Find d, the minimum distance between |
|the (n^2-n)/2 pairs of points. If the points are truly inde-|
|pendent uniform, then d^2, the square of the minimum distance|
|should be (very close to) exponentially distributed with mean|
|.995 . Thus 1-exp(-d^2/.995) should provide a p-value and a|
|KSTEST on the resulting 10 values serves as a test of uni- |
|formity for those samples of 8000 random points in a square. |
|-------------------------------------------------------------|
Results for the MINIMUM DISTANCE test for urandom.bin
0.0803,0.0480,0.1170,0.0949,0.0512,0.0022,0.0153,0.0013,0.1701,0.1019,
The KS test for those 10 p-values: 0.000000
|-------------------------------------------------------------|
| THE 3DSPHERES TEST |
|Choose 4000 random points in a cube of edge 1000. At each |
|point, center a sphere large enough to reach the next closest|
|point. Then the volume of the smallest such sphere is (very |
|close to) exponentially distributed with mean 120pi/3. Thus |
|the radius cubed is exponential with mean 30. (The mean is |
|obtained by extensive simulation). The 3DSPHERES test gener-|
|ates 4000 such spheres 20 times. Each min radius cubed leads|
|to a uniform variable by means of 1-exp(-r^3/30.), then a |
| KSTEST is done on the 20 p-values. |
|-------------------------------------------------------------|
The 3DSPHERES test for urandom.bin
sample no r^3 equiv. uni.
1 0.963 0.031597
2 0.118 0.003925
3 0.869 0.028544
4 5.058 0.155142
5 0.216 0.007183
6 5.770 0.174970
7 0.100 0.003314
8 0.184 0.006110
9 0.695 0.022914
10 0.680 0.022418
11 0.487 0.016110
12 1.311 0.042757
13 0.487 0.016099
14 0.788 0.025917
15 0.735 0.024213
16 0.019 0.000621
17 1.948 0.062871
18 0.935 0.030687
19 14.768 0.388763
20 1.460 0.047488
--------------------------------------------------------------
p-value for KS test on those 20 p-values: 0.000000
|-------------------------------------------------------------|
| This is the SQUEEZE test |
| Random integers are floated to get uniforms on [0,1). Start-|
| ing with k=2^31=2147483647, the test finds j, the number of |
| iterations necessary to reduce k to 1, using the reduction |
| k=ceiling(k*U), with U provided by floating integers from |
| the file being tested. Such j's are found 100,000 times, |
| then counts for the number of times j was <=6,7,...,47,>=48 |
| are used to provide a chi-square test for cell frequencies. |
|-------------------------------------------------------------|
RESULTS OF SQUEEZE TEST FOR urandom.bin
Table of standardized frequency counts
(obs-exp)^2/exp for j=(1,..,6), 7,...,47,(48,...)
28.9 70.8 145.9 267.2 414.2 576.1
646.0 603.6 461.7 285.3 123.4 16.0
-43.8 -72.2 -83.3 -88.5 -90.5 -90.5
-88.6 -85.0 -80.0 -74.0 -67.2 -60.1
-52.9 -45.9 -39.2 -33.1 -27.5 -22.6
-18.4 -14.8 -11.7 -9.2 -7.2 -5.5
-4.2 -3.2 -2.4 -1.8 -1.3 -1.0
-1.1
Chi-square with 42 degrees of freedom:1776573.502178
z-score=193835.478172, p-value=1.000000
_____________________________________________________________
|-------------------------------------------------------------|
| 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. |
|-------------------------------------------------------------|
Results of the OSUM test for urandom.bin
Test no p-value
1 0.000000
2 0.000000
3 0.000000
4 0.000000
5 0.000000
6 0.000000
7 0.000000
8 0.000000
9 0.000000
10 0.000000
_____________________________________________________________
p-value for 10 kstests on 100 sums: 0.000000
|----------------------------------------------------------|
|This is the UP-DOWN RUNS test. An up-run of length n has |
|x_1<...x_(n+1), while a down-run of length n |
|has x_1>...>x_n and x_n=2, the prob. of a run of length k is 2*k/(k+1)!)
Length Expected UpRuns (O-E)^2/E DownRuns (O-E)^2/E
2 66666.67 66621 0.03 66892 0.76
3 25000.00 24993 0.00 24880 0.58
4 6666.67 6706 0.23 6547 2.15
5 1388.89 1400 0.09 1399 0.07
6 238.10 243 0.10 238 0.00
7 34.72 35 0.00 36 0.05
8 4.96 1 3.16 7 0.84
p=0.27193 p=0.38339
Number of rngs required: 687880, p-value: 0.273
|-------------------------------------------------------------|
|This the CRAPS TEST. It plays 200,000 games of craps, counts|
|the number of wins and the number of throws necessary to end |
|each game. The number of wins should be (very close to) a |
|normal with mean 200000p and variance 200000p(1-p), and |
|p=244/495. Throws necessary to complete the game can vary |
|from 1 to infinity, but counts for all>21 are lumped with 21.|
|A chi-square test is made on the no.-of-throws cell counts. |
|Each 32-bit integer from the test file provides the value for|
|the throw of a die, by floating to [0,1), multiplying by 6 |
|and taking 1 plus the integer part of the result. |
|-------------------------------------------------------------|
RESULTS OF CRAPS TEST for urandom.bin
No. of wins: Observed Expected
132432 98585.9
z-score=151.380, pvalue=1.00000
Analysis of Throws-per-Game:
Throws Observed Expected Chisq Sum of (O-E)^2/E
1 66611 66666.7 0.046 0.046
2 35010 37654.3 185.701 185.747
3 24816 26954.7 169.698 355.446
4 17790 19313.5 120.172 475.618
5 12984 13851.4 54.321 529.938
6 9556 9943.5 15.104 545.042
7 6985 7145.0 3.584 548.627
8 5358 5139.1 9.326 557.953
9 4045 3699.9 32.195 590.148
10 3154 2666.3 89.208 679.356
11 2519 1923.3 184.484 863.840
12 1924 1388.7 206.304 1070.144
13 1513 1003.7 258.411 1328.555
14 1221 726.1 337.243 1665.798
15 992 525.8 413.264 2079.062
16 837 381.2 545.188 2624.250
17 686 276.5 606.271 3230.521
18 540 200.8 572.805 3803.326
19 498 146.0 848.824 4652.150
20 409 106.2 863.140 5515.290
21 2552 287.1 17866.452 23381.742
Chisq=23381.74 for 20 degrees of freedom, p= 1.00000
SUMMARY of craptest
p-value for no. of wins: 1.000000
p-value for throws/game: 1.000000
_____________________________________________________________
|-------------------------------------------------------------|
|This is the CRAPS TEST with different dice. Each die value is|
|determined by the rightmost three bits of the 32-bit random |
|integer; values 1 to 6 are accepted, others rejected. As in |
|the first test, 200,000 games of craps are played, counting |
|the number of wins and the number of throws necessary to end |
|each game. The number of wins should be (very close to) a |
|normal with mean 200000p and variance 200000p(1-p), and |
|p=244/495. Throws necessary to complete the game can vary |
|from 1 to infinity, but counts for all>21 are lumped with 21.|
|A chi-square test is made on the no.-of-throws cell counts. |
|-------------------------------------------------------------|
RESULTS OF CRAPS TEST2 for urandom.bin
No. of wins: Observed Expected
98516 98585.9
z-score=-0.312, pvalue=0.37735
Analysis of Throws-per-Game:
Throws Observed Expected Chisq Sum of (O-E)^2/E
1 66874 66666.7 0.645 0.645
2 37536 37654.3 0.372 1.017
3 26921 26954.7 0.042 1.059
4 19248 19313.5 0.222 1.281
5 13892 13851.4 0.119 1.400
6 9958 9943.5 0.021 1.421
7 7170 7145.0 0.087 1.508
8 5167 5139.1 0.152 1.660
9 3694 3699.9 0.009 1.669
10 2596 2666.3 1.853 3.522
11 1938 1923.3 0.112 3.634
12 1386 1388.7 0.005 3.640
13 1023 1003.7 0.371 4.010
14 698 726.1 1.091 5.101
15 525 525.8 0.001 5.102
16 380 381.2 0.003 5.106
17 271 276.5 0.111 5.217
18 199 200.8 0.017 5.233
19 134 146.0 0.984 6.217
20 101 106.2 0.256 6.473
21 289 287.1 0.012 6.486
Chisq= 6.49 for 20 degrees of freedom, p= 0.00194
SUMMARY of craptest
p-value for no. of wins: 0.377350
p-value for throws/game: 0.001938
_____________________________________________________________
***** TEST SUMMARY *****
All p-values:
1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,0.0000,
1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,
1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,
1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,0.0000,1.0000,
1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,
1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,
1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,
1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,
1.0000,1.0000,0.2830,0.6181,0.6699,1.0000,1.0000,1.0000,1.0000,1.0000,
0.6637,0.4941,0.0011,1.0000,1.0000,1.0000,1.0000,1.0000,0.0963,0.5920,
0.5788,1.0000,1.0000,1.0000,1.0000,1.0000,0.0609,0.8460,0.7858,1.0000,
0.2169,0.3558,0.8943,0.0259,0.4585,0.1153,1.0000,1.0000,0.7481,0.1549,
0.8970,0.4224,0.9134,0.9253,1.0000,1.0000,0.7151,0.3881,0.1671,0.8927,
0.6088,0.2773,1.0000,1.0000,0.0774,0.9436,0.5031,0.7060,0.0339,0.1119,
1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,
1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,
1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,0.0000,0.0000,0.0000,
0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0803,0.0480,
0.1170,0.0949,0.0512,0.0022,0.0153,0.0013,0.1701,0.1019,0.0000,0.0316,
0.0039,0.0285,0.1551,0.0072,0.1750,0.0033,0.0061,0.0229,0.0224,0.0161,
0.0428,0.0161,0.0259,0.0242,0.0006,0.0629,0.0307,0.3888,0.0475,0.0000,
1.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,
0.0000,0.0000,0.2719,0.3834,0.2732,1.0000,1.0000,0.3773,0.0019,
Overall p-value after applying KStest on 229 p-values = 0.000000
In response to requests, we have provided a list of all the p-values
produced by the tests you have chosen for this run. The individual
p-values are supposed to be uniform in [0,1), but they are not necessarily
independent. So even though we have applied a KSTEST to the accumulated
p-values, the result is not necessarily---even if your file contains truly
random bits---uniform in [0,1). But it is probably pretty close, so take
that last p-value with a grain of salt. In particular, there may be some
values so close to 0 or 1 that the tests they came from should be applied
several more times, or new, related tests should be undertaken.