NOTE: Most of the tests in DIEHARD return a p-value, which should be uniform on [0,1) if the input file contains truly independent random bits. Those p-values are obtained by p=F(X), where F is the assumed distribution of the sample random variable X---often normal. But that assumed F is just an asymptotic approximation, for which the fit will be worst in the tails. Thus you should not be surprised with occasional p-values near 0 or 1, such as .0012 or .9983. When a bit stream really FAILS BIG, you will get p's of 0 or 1 to six or more places. By all means, do not, as a Statistician might, think that a p < .025 or p> .975 means that the RNG has "failed the test at the .05 level". Such p's happen among the hundreds that DIEHARD produces, even with good RNG's. So keep in mind that " p happens". ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the BIRTHDAY SPACINGS TEST :: :: Choose m birthdays in a year of n days. List the spacings :: :: between the birthdays. If j is the number of values that :: :: occur more than once in that list, then j is asymptotically :: :: Poisson distributed with mean m^3/(4n). Experience shows n :: :: must be quite large, say n>=2^18, for comparing the results :: :: to the Poisson distribution with that mean. This test uses :: :: n=2^24 and m=2^9, so that the underlying distribution for j :: :: is taken to be Poisson with lambda=2^27/(2^26)=2. A sample :: :: of 500 j's is taken, and a chi-square goodness of fit test :: :: provides a p value. The first test uses bits 1-24 (counting :: :: from the left) from integers in the specified file. :: :: Then the file is closed and reopened. Next, bits 2-25 are :: :: used to provide birthdays, then 3-26 and so on to bits 9-32. :: :: Each set of bits provides a p-value, and the nine p-values :: :: provide a sample for a KSTEST. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: BIRTHDAY SPACINGS TEST, M= 512 N=2**24 LAMBDA= 2.0000 Results for zz_001.bin For a sample of size 500: mean zz_001.bin using bits 1 to 24 2.024 duplicate number number spacings observed expected 0 69. 67.668 1 133. 135.335 2 141. 135.335 3 76. 90.224 4 50. 45.112 5 20. 18.045 6 to INF 11. 8.282 Chisquare with 6 d.o.f. = 4.18 p-value= .347619 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean zz_001.bin using bits 2 to 25 2.030 duplicate number number spacings observed expected 0 60. 67.668 1 131. 135.335 2 144. 135.335 3 92. 90.224 4 52. 45.112 5 16. 18.045 6 to INF 5. 8.282 Chisquare with 6 d.o.f. = 4.18 p-value= .347857 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean zz_001.bin using bits 3 to 26 1.876 duplicate number number spacings observed expected 0 75. 67.668 1 148. 135.335 2 135. 135.335 3 81. 90.224 4 36. 45.112 5 20. 18.045 6 to INF 5. 8.282 Chisquare with 6 d.o.f. = 6.28 p-value= .607028 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean zz_001.bin using bits 4 to 27 2.064 duplicate number number spacings observed expected 0 57. 67.668 1 131. 135.335 2 136. 135.335 3 107. 90.224 4 44. 45.112 5 20. 18.045 6 to INF 5. 8.282 Chisquare with 6 d.o.f. = 6.48 p-value= .628699 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean zz_001.bin using bits 5 to 28 1.902 duplicate number number spacings observed expected 0 80. 67.668 1 134. 135.335 2 134. 135.335 3 95. 90.224 4 33. 45.112 5 13. 18.045 6 to INF 11. 8.282 Chisquare with 6 d.o.f. = 8.08 p-value= .767775 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean zz_001.bin using bits 6 to 29 1.860 duplicate number number spacings observed expected 0 82. 67.668 1 144. 135.335 2 138. 135.335 3 73. 90.224 4 31. 45.112 5 25. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 14.22 p-value= .972774 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean zz_001.bin using bits 7 to 30 1.882 duplicate number number spacings observed expected 0 85. 67.668 1 130. 135.335 2 142. 135.335 3 73. 90.224 4 45. 45.112 5 22. 18.045 6 to INF 3. 8.282 Chisquare with 6 d.o.f. = 12.50 p-value= .948333 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean zz_001.bin using bits 8 to 31 2.020 duplicate number number spacings observed expected 0 73. 67.668 1 133. 135.335 2 128. 135.335 3 89. 90.224 4 45. 45.112 5 20. 18.045 6 to INF 12. 8.282 Chisquare with 6 d.o.f. = 2.76 p-value= .161227 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean zz_001.bin using bits 9 to 32 2.060 duplicate number number spacings observed expected 0 70. 67.668 1 126. 135.335 2 139. 135.335 3 88. 90.224 4 44. 45.112 5 18. 18.045 6 to INF 15. 8.282 Chisquare with 6 d.o.f. = 6.36 p-value= .615450 ::::::::::::::::::::::::::::::::::::::::: The 9 p-values were .347619 .347857 .607028 .628699 .767775 .972774 .948333 .161227 .615450 A KSTEST for the 9 p-values yields .542438 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: THE OVERLAPPING 5-PERMUTATION TEST :: :: This is the OPERM5 test. It looks at a sequence of one mill- :: :: ion 32-bit random integers. Each set of five consecutive :: :: integers can be in one of 120 states, for the 5! possible or- :: :: derings of five numbers. Thus the 5th, 6th, 7th,...numbers :: :: each provide a state. As many thousands of state transitions :: :: are observed, cumulative counts are made of the number of :: :: occurences of each state. Then the quadratic form in the :: :: weak inverse of the 120x120 covariance matrix yields a test :: :: equivalent to the likelihood ratio test that the 120 cell :: :: counts came from the specified (asymptotically) normal dis- :: :: tribution with the specified 120x120 covariance matrix (with :: :: rank 99). This version uses 1,000,000 integers, twice. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: OPERM5 test for file zz_001.bin For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=119.723; p-value= .923329 OPERM5 test for file zz_001.bin For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom= 98.071; p-value= .492482 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 zz_001.bin Rank test for 31x31 binary matrices: rows from leftmost 31 bits of each 32-bit integer rank observed expected (o-e)^2/e sum 28 205 211.4 .194832 .195 29 5067 5134.0 .874633 1.069 30 23242 23103.0 .835733 1.905 31 11486 11551.5 .371678 2.277 chisquare= 2.277 for 3 d. of f.; p-value= .548693 -------------------------------------------------------------- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the BINARY RANK TEST for 32x32 matrices. A random 32x :: :: 32 binary matrix is formed, each row a 32-bit random integer. :: :: The rank is determined. That rank can be from 0 to 32, ranks :: :: less than 29 are rare, and their counts are pooled with those :: :: for rank 29. Ranks are found for 40,000 such random matrices :: :: and a chisquare test is performed on counts for ranks 32,31, :: :: 30 and <=29. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Binary rank test for zz_001.bin Rank test for 32x32 binary matrices: rows from leftmost 32 bits of each 32-bit integer rank observed expected (o-e)^2/e sum 29 203 211.4 .335179 .335 30 5158 5134.0 .112097 .447 31 23073 23103.0 .039078 .486 32 11566 11551.5 .018140 .504 chisquare= .504 for 3 d. of f.; p-value= .320863 -------------------------------------------------------------- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the BINARY RANK TEST for 6x8 matrices. From each of :: :: six random 32-bit integers from the generator under test, a :: :: specified byte is chosen, and the resulting six bytes form a :: :: 6x8 binary matrix whose rank is determined. That rank can be :: :: from 0 to 6, but ranks 0,1,2,3 are rare; their counts are :: :: pooled with those for rank 4. Ranks are found for 100,000 :: :: random matrices, and a chi-square test is performed on :: :: counts for ranks 6,5 and <=4. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Binary Rank Test for zz_001.bin Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 1 to 8 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 926 944.3 .355 .355 r =5 21798 21743.9 .135 .489 r =6 77276 77311.8 .017 .506 p=1-exp(-SUM/2)= .22348 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 2 to 9 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 949 944.3 .023 .023 r =5 21504 21743.9 2.647 2.670 r =6 77547 77311.8 .716 3.386 p=1-exp(-SUM/2)= .81601 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 3 to 10 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 903 944.3 1.806 1.806 r =5 21654 21743.9 .372 2.178 r =6 77443 77311.8 .223 2.401 p=1-exp(-SUM/2)= .69892 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 4 to 11 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 989 944.3 2.116 2.116 r =5 21836 21743.9 .390 2.506 r =6 77175 77311.8 .242 2.748 p=1-exp(-SUM/2)= .74691 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 5 to 12 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 973 944.3 .872 .872 r =5 21815 21743.9 .232 1.105 r =6 77212 77311.8 .129 1.234 p=1-exp(-SUM/2)= .46031 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 6 to 13 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 967 944.3 .546 .546 r =5 21644 21743.9 .459 1.005 r =6 77389 77311.8 .077 1.082 p=1-exp(-SUM/2)= .41774 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 7 to 14 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 946 944.3 .003 .003 r =5 21552 21743.9 1.694 1.697 r =6 77502 77311.8 .468 2.165 p=1-exp(-SUM/2)= .66118 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 8 to 15 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 956 944.3 .145 .145 r =5 21793 21743.9 .111 .256 r =6 77251 77311.8 .048 .304 p=1-exp(-SUM/2)= .14085 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 9 to 16 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 956 944.3 .145 .145 r =5 21921 21743.9 1.442 1.587 r =6 77123 77311.8 .461 2.048 p=1-exp(-SUM/2)= .64093 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 10 to 17 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 985 944.3 1.754 1.754 r =5 21640 21743.9 .496 2.251 r =6 77375 77311.8 .052 2.302 p=1-exp(-SUM/2)= .68371 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 11 to 18 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 969 944.3 .646 .646 r =5 21649 21743.9 .414 1.060 r =6 77382 77311.8 .064 1.124 p=1-exp(-SUM/2)= .42991 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 12 to 19 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 932 944.3 .160 .160 r =5 21755 21743.9 .006 .166 r =6 77313 77311.8 .000 .166 p=1-exp(-SUM/2)= .07962 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 13 to 20 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 900 944.3 2.078 2.078 r =5 21907 21743.9 1.223 3.302 r =6 77193 77311.8 .183 3.484 p=1-exp(-SUM/2)= .82486 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 14 to 21 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 946 944.3 .003 .003 r =5 21760 21743.9 .012 .015 r =6 77294 77311.8 .004 .019 p=1-exp(-SUM/2)= .00949 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 15 to 22 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 936 944.3 .073 .073 r =5 21724 21743.9 .018 .091 r =6 77340 77311.8 .010 .101 p=1-exp(-SUM/2)= .04947 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 16 to 23 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 967 944.3 .546 .546 r =5 21846 21743.9 .479 1.025 r =6 77187 77311.8 .201 1.227 p=1-exp(-SUM/2)= .45841 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 17 to 24 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 918 944.3 .733 .733 r =5 21743 21743.9 .000 .733 r =6 77339 77311.8 .010 .742 p=1-exp(-SUM/2)= .31001 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 18 to 25 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 925 944.3 .395 .395 r =5 21551 21743.9 1.711 2.106 r =6 77524 77311.8 .582 2.688 p=1-exp(-SUM/2)= .73923 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 19 to 26 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 897 944.3 2.369 2.369 r =5 21609 21743.9 .837 3.206 r =6 77494 77311.8 .429 3.636 p=1-exp(-SUM/2)= .83762 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 20 to 27 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 959 944.3 .229 .229 r =5 22001 21743.9 3.040 3.269 r =6 77040 77311.8 .956 4.224 p=1-exp(-SUM/2)= .87902 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 21 to 28 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 967 944.3 .546 .546 r =5 21610 21743.9 .825 1.370 r =6 77423 77311.8 .160 1.530 p=1-exp(-SUM/2)= .53469 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 22 to 29 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 846 944.3 10.233 10.233 r =5 21860 21743.9 .620 10.853 r =6 77294 77311.8 .004 10.857 p=1-exp(-SUM/2)= .99561 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 23 to 30 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 887 944.3 3.477 3.477 r =5 21910 21743.9 1.269 4.746 r =6 77203 77311.8 .153 4.899 p=1-exp(-SUM/2)= .91367 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 24 to 31 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 969 944.3 .646 .646 r =5 21446 21743.9 4.081 4.727 r =6 77585 77311.8 .965 5.693 p=1-exp(-SUM/2)= .94195 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG zz_001.bin b-rank test for bits 25 to 32 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 937 944.3 .056 .056 r =5 21440 21743.9 4.247 4.304 r =6 77623 77311.8 1.253 5.556 p=1-exp(-SUM/2)= .93785 TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices These should be 25 uniform [0,1] random variables: .223484 .816006 .698917 .746908 .460311 .417743 .661180 .140851 .640927 .683714 .429913 .079617 .824859 .009493 .049470 .458415 .310012 .739230 .837624 .879024 .534694 .995611 .913665 .941946 .937853 brank test summary for zz_001.bin The KS test for those 25 supposed UNI's yields KS p-value= .725723 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: THE BITSTREAM TEST :: :: The file under test is viewed as a stream of bits. Call them :: :: b1,b2,... . Consider an alphabet with two "letters", 0 and 1 :: :: and think of the stream of bits as a succession of 20-letter :: :: "words", overlapping. Thus the first word is b1b2...b20, the :: :: second is b2b3...b21, and so on. The bitstream test counts :: :: the number of missing 20-letter (20-bit) words in a string of :: :: 2^21 overlapping 20-letter words. There are 2^20 possible 20 :: :: letter words. For a truly random string of 2^21+19 bits, the :: :: number of missing words j should be (very close to) normally :: :: distributed with mean 141,909 and sigma 428. Thus :: :: (j-141909)/428 should be a standard normal variate (z score) :: :: that leads to a uniform [0,1) p value. The test is repeated :: :: twenty times. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: THE OVERLAPPING 20-tuples BITSTREAM TEST, 20 BITS PER WORD, N words This test uses N=2^21 and samples the bitstream 20 times. No. missing words should average 141909. with sigma=428. --------------------------------------------------------- tst no 1: 141690 missing words, -.51 sigmas from mean, p-value= .30417 tst no 2: 142198 missing words, .67 sigmas from mean, p-value= .74999 tst no 3: 142365 missing words, 1.06 sigmas from mean, p-value= .85648 tst no 4: 141418 missing words, -1.15 sigmas from mean, p-value= .12549 tst no 5: 142061 missing words, .35 sigmas from mean, p-value= .63847 tst no 6: 141101 missing words, -1.89 sigmas from mean, p-value= .02947 tst no 7: 142674 missing words, 1.79 sigmas from mean, p-value= .96300 tst no 8: 141270 missing words, -1.49 sigmas from mean, p-value= .06762 tst no 9: 142198 missing words, .67 sigmas from mean, p-value= .74999 tst no 10: 142841 missing words, 2.18 sigmas from mean, p-value= .98525 tst no 11: 142011 missing words, .24 sigmas from mean, p-value= .59389 tst no 12: 141381 missing words, -1.23 sigmas from mean, p-value= .10852 tst no 13: 142329 missing words, .98 sigmas from mean, p-value= .83659 tst no 14: 141504 missing words, -.95 sigmas from mean, p-value= .17181 tst no 15: 143191 missing words, 2.99 sigmas from mean, p-value= .99863 tst no 16: 141775 missing words, -.31 sigmas from mean, p-value= .37682 tst no 17: 141476 missing words, -1.01 sigmas from mean, p-value= .15566 tst no 18: 141861 missing words, -.11 sigmas from mean, p-value= .45505 tst no 19: 141884 missing words, -.06 sigmas from mean, p-value= .47641 tst no 20: 141200 missing words, -1.66 sigmas from mean, p-value= .04873 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: The tests OPSO, OQSO and DNA :: :: OPSO means Overlapping-Pairs-Sparse-Occupancy :: :: The OPSO test considers 2-letter words from an alphabet of :: :: 1024 letters. Each letter is determined by a specified ten :: :: bits from a 32-bit integer in the sequence to be tested. OPSO :: :: generates 2^21 (overlapping) 2-letter words (from 2^21+1 :: :: "keystrokes") and counts the number of missing words---that :: :: is 2-letter words which do not appear in the entire sequence. :: :: That count should be very close to normally distributed with :: :: mean 141,909, sigma 290. Thus (missingwrds-141909)/290 should :: :: be a standard normal variable. The OPSO test takes 32 bits at :: :: a time from the test file and uses a designated set of ten :: :: consecutive bits. It then restarts the file for the next de- :: :: signated 10 bits, and so on. :: :: :: :: OQSO means Overlapping-Quadruples-Sparse-Occupancy :: :: The test OQSO is similar, except that it considers 4-letter :: :: words from an alphabet of 32 letters, each letter determined :: :: by a designated string of 5 consecutive bits from the test :: :: file, elements of which are assumed 32-bit random integers. :: :: The mean number of missing words in a sequence of 2^21 four- :: :: letter words, (2^21+3 "keystrokes"), is again 141909, with :: :: sigma = 295. The mean is based on theory; sigma comes from :: :: extensive simulation. :: :: :: :: The DNA test considers an alphabet of 4 letters:: C,G,A,T,:: :: determined by two designated bits in the sequence of random :: :: integers being tested. It considers 10-letter words, so that :: :: as in OPSO and OQSO, there are 2^20 possible words, and the :: :: mean number of missing words from a string of 2^21 (over- :: :: lapping) 10-letter words (2^21+9 "keystrokes") is 141909. :: :: The standard deviation sigma=339 was determined as for OQSO :: :: by simulation. (Sigma for OPSO, 290, is the true value (to :: :: three places), not determined by simulation. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: OPSO test for generator zz_001.bin Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OPSO for zz_001.bin using bits 23 to 32 141904 -.018 .4927 OPSO for zz_001.bin using bits 22 to 31 141633 -.953 .1703 OPSO for zz_001.bin using bits 21 to 30 142138 .789 .7848 OPSO for zz_001.bin using bits 20 to 29 141980 .244 .5963 OPSO for zz_001.bin using bits 19 to 28 142293 1.323 .9071 OPSO for zz_001.bin using bits 18 to 27 142033 .426 .6651 OPSO for zz_001.bin using bits 17 to 26 142012 .354 .6383 OPSO for zz_001.bin using bits 16 to 25 141841 -.236 .4069 OPSO for zz_001.bin using bits 15 to 24 141897 -.043 .4830 OPSO for zz_001.bin using bits 14 to 23 141872 -.129 .4488 OPSO for zz_001.bin using bits 13 to 22 141740 -.584 .2796 OPSO for zz_001.bin using bits 12 to 21 141923 .047 .5188 OPSO for zz_001.bin using bits 11 to 20 141901 -.029 .4885 OPSO for zz_001.bin using bits 10 to 19 141886 -.080 .4679 OPSO for zz_001.bin using bits 9 to 18 141836 -.253 .4002 OPSO for zz_001.bin using bits 8 to 17 141615 -1.015 .1551 OPSO for zz_001.bin using bits 7 to 16 142086 .609 .7288 OPSO for zz_001.bin using bits 6 to 15 141646 -.908 .1819 OPSO for zz_001.bin using bits 5 to 14 141354 -1.915 .0278 OPSO for zz_001.bin using bits 4 to 13 141866 -.149 .4406 OPSO for zz_001.bin using bits 3 to 12 141807 -.353 .3621 OPSO for zz_001.bin using bits 2 to 11 141907 -.008 .4968 OPSO for zz_001.bin using bits 1 to 10 141841 -.236 .4069 OQSO test for generator zz_001.bin Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OQSO for zz_001.bin using bits 28 to 32 141667 -.821 .2057 OQSO for zz_001.bin using bits 27 to 31 142419 1.728 .9580 OQSO for zz_001.bin using bits 26 to 30 142260 1.189 .8827 OQSO for zz_001.bin using bits 25 to 29 141875 -.116 .4537 OQSO for zz_001.bin using bits 24 to 28 142136 .768 .7789 OQSO for zz_001.bin using bits 23 to 27 142385 1.612 .9466 OQSO for zz_001.bin using bits 22 to 26 141733 -.598 .2750 OQSO for zz_001.bin using bits 21 to 25 141727 -.618 .2683 OQSO for zz_001.bin using bits 20 to 24 141687 -.754 .2255 OQSO for zz_001.bin using bits 19 to 23 142294 1.304 .9039 OQSO for zz_001.bin using bits 18 to 22 141750 -.540 .2946 OQSO for zz_001.bin using bits 17 to 21 141817 -.313 .3771 OQSO for zz_001.bin using bits 16 to 20 141714 -.662 .2539 OQSO for zz_001.bin using bits 15 to 19 141740 -.574 .2830 OQSO for zz_001.bin using bits 14 to 18 141676 -.791 .2145 OQSO for zz_001.bin using bits 13 to 17 142019 .372 .6450 OQSO for zz_001.bin using bits 12 to 16 141919 .033 .5131 OQSO for zz_001.bin using bits 11 to 15 141759 -.510 .3052 OQSO for zz_001.bin using bits 10 to 14 142043 .453 .6748 OQSO for zz_001.bin using bits 9 to 13 141948 .131 .5521 OQSO for zz_001.bin using bits 8 to 12 141727 -.618 .2683 OQSO for zz_001.bin using bits 7 to 11 141965 .189 .5748 OQSO for zz_001.bin using bits 6 to 10 141868 -.140 .4443 OQSO for zz_001.bin using bits 5 to 9 142257 1.179 .8807 OQSO for zz_001.bin using bits 4 to 8 142033 .419 .6625 OQSO for zz_001.bin using bits 3 to 7 142109 .677 .7508 OQSO for zz_001.bin using bits 2 to 6 141814 -.323 .3733 OQSO for zz_001.bin using bits 1 to 5 141462 -1.516 .0647 DNA test for generator zz_001.bin Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p DNA for zz_001.bin using bits 31 to 32 141662 -.730 .2328 DNA for zz_001.bin using bits 30 to 31 141715 -.573 .2832 DNA for zz_001.bin using bits 29 to 30 141179 -2.154 .0156 DNA for zz_001.bin using bits 28 to 29 141258 -1.921 .0273 DNA for zz_001.bin using bits 27 to 28 142417 1.498 .9329 DNA for zz_001.bin using bits 26 to 27 141947 .111 .5442 DNA for zz_001.bin using bits 25 to 26 142142 .686 .7538 DNA for zz_001.bin using bits 24 to 25 142355 1.315 .9057 DNA for zz_001.bin using bits 23 to 24 142358 1.324 .9072 DNA for zz_001.bin using bits 22 to 23 141442 -1.379 .0840 DNA for zz_001.bin using bits 21 to 22 141963 .158 .5629 DNA for zz_001.bin using bits 20 to 21 141898 -.033 .4867 DNA for zz_001.bin using bits 19 to 20 141379 -1.564 .0589 DNA for zz_001.bin using bits 18 to 19 141342 -1.674 .0471 DNA for zz_001.bin using bits 17 to 18 142039 .383 .6490 DNA for zz_001.bin using bits 16 to 17 141779 -.384 .3503 DNA for zz_001.bin using bits 15 to 16 142165 .754 .7746 DNA for zz_001.bin using bits 14 to 15 141859 -.148 .4410 DNA for zz_001.bin using bits 13 to 14 142502 1.748 .9598 DNA for zz_001.bin using bits 12 to 13 141904 -.016 .4937 DNA for zz_001.bin using bits 11 to 12 141378 -1.567 .0585 DNA for zz_001.bin using bits 10 to 11 142060 .444 .6716 DNA for zz_001.bin using bits 9 to 10 141911 .005 .5020 DNA for zz_001.bin using bits 8 to 9 142460 1.624 .9479 DNA for zz_001.bin using bits 7 to 8 142548 1.884 .9702 DNA for zz_001.bin using bits 6 to 7 142207 .878 .8101 DNA for zz_001.bin using bits 5 to 6 141798 -.328 .3713 DNA for zz_001.bin using bits 4 to 5 141930 .061 .5243 DNA for zz_001.bin using bits 3 to 4 141764 -.429 .3341 DNA for zz_001.bin using bits 2 to 3 141707 -.597 .2753 DNA for zz_001.bin using bits 1 to 2 141962 .155 .5617 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the COUNT-THE-1's TEST on a stream of bytes. :: :: Consider the file under test as a stream of bytes (four per :: :: 32 bit integer). Each byte can contain from 0 to 8 1's, :: :: with probabilities 1,8,28,56,70,56,28,8,1 over 256. Now let :: :: the stream of bytes provide a string of overlapping 5-letter :: :: words, each "letter" taking values A,B,C,D,E. The letters are :: :: determined by the number of 1's in a byte:: 0,1,or 2 yield A,:: :: 3 yields B, 4 yields C, 5 yields D and 6,7 or 8 yield E. Thus :: :: we have a monkey at a typewriter hitting five keys with vari- :: :: ous probabilities (37,56,70,56,37 over 256). There are 5^5 :: :: possible 5-letter words, and from a string of 256,000 (over- :: :: lapping) 5-letter words, counts are made on the frequencies :: :: for each word. The quadratic form in the weak inverse of :: :: the covariance matrix of the cell counts provides a chisquare :: :: test:: Q5-Q4, the difference of the naive Pearson sums of :: :: (OBS-EXP)^2/EXP on counts for 5- and 4-letter cell counts. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Test results for zz_001.bin Chi-square with 5^5-5^4=2500 d.of f. for sample size:2560000 chisquare equiv normal p-value Results fo COUNT-THE-1's in successive bytes: byte stream for zz_001.bin 2508.18 .116 .546043 byte stream for zz_001.bin 2467.16 -.464 .321184 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the COUNT-THE-1's TEST for specific bytes. :: :: Consider the file under test as a stream of 32-bit integers. :: :: From each integer, a specific byte is chosen , say the left- :: :: most:: bits 1 to 8. Each byte can contain from 0 to 8 1's, :: :: with probabilitie 1,8,28,56,70,56,28,8,1 over 256. Now let :: :: the specified bytes from successive integers provide a string :: :: of (overlapping) 5-letter words, each "letter" taking values :: :: A,B,C,D,E. The letters are determined by the number of 1's, :: :: in that byte:: 0,1,or 2 ---> A, 3 ---> B, 4 ---> C, 5 ---> D,:: :: and 6,7 or 8 ---> E. Thus we have a monkey at a typewriter :: :: hitting five keys with with various probabilities:: 37,56,70,:: :: 56,37 over 256. There are 5^5 possible 5-letter words, and :: :: from a string of 256,000 (overlapping) 5-letter words, counts :: :: are made on the frequencies for each word. The quadratic form :: :: in the weak inverse of the covariance matrix of the cell :: :: counts provides a chisquare test:: Q5-Q4, the difference of :: :: the naive Pearson sums of (OBS-EXP)^2/EXP on counts for 5- :: :: and 4-letter cell counts. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Chi-square with 5^5-5^4=2500 d.of f. for sample size: 256000 chisquare equiv normal p value Results for COUNT-THE-1's in specified bytes: bits 1 to 8 2575.39 1.066 .856819 bits 2 to 9 2411.91 -1.246 .106418 bits 3 to 10 2471.37 -.405 .342760 bits 4 to 11 2680.47 2.552 .994649 bits 5 to 12 2470.42 -.418 .337874 bits 6 to 13 2488.84 -.158 .437277 bits 7 to 14 2487.69 -.174 .430909 bits 8 to 15 2403.44 -1.366 .086038 bits 9 to 16 2483.41 -.235 .407245 bits 10 to 17 2371.70 -1.814 .034809 bits 11 to 18 2484.54 -.219 .413447 bits 12 to 19 2488.11 -.168 .433237 bits 13 to 20 2534.47 .487 .687019 bits 14 to 21 2421.54 -1.110 .133582 bits 15 to 22 2486.73 -.188 .425554 bits 16 to 23 2468.12 -.451 .326049 bits 17 to 24 2471.40 -.404 .342945 bits 18 to 25 2460.23 -.562 .286898 bits 19 to 26 2544.74 .633 .736543 bits 20 to 27 2424.27 -1.071 .142091 bits 21 to 28 2445.58 -.770 .220758 bits 22 to 29 2616.48 1.647 .950255 bits 23 to 30 2581.11 1.147 .874326 bits 24 to 31 2444.67 -.782 .216971 bits 25 to 32 2364.89 -1.911 .028014 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: THIS IS A PARKING LOT TEST :: :: In a square of side 100, randomly "park" a car---a circle of :: :: radius 1. Then try to park a 2nd, a 3rd, and so on, each :: :: time parking "by ear". That is, if an attempt to park a car :: :: causes a crash with one already parked, try again at a new :: :: random location. (To avoid path problems, consider parking :: :: helicopters rather than cars.) Each attempt leads to either :: :: a crash or a success, the latter followed by an increment to :: :: the list of cars already parked. If we plot n: the number of :: :: attempts, versus k:: the number successfully parked, we get a:: :: curve that should be similar to those provided by a perfect :: :: random number generator. Theory for the behavior of such a :: :: random curve seems beyond reach, and as graphics displays are :: :: not available for this battery of tests, a simple characteriz :: :: ation of the random experiment is used: k, the number of cars :: :: successfully parked after n=12,000 attempts. Simulation shows :: :: that k should average 3523 with sigma 21.9 and is very close :: :: to normally distributed. Thus (k-3523)/21.9 should be a st- :: :: andard normal variable, which, converted to a uniform varia- :: :: ble, provides input to a KSTEST based on a sample of 10. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: CDPARK: result of ten tests on file zz_001.bin Of 12,000 tries, the average no. of successes should be 3523 with sigma=21.9 Successes: 3490 z-score: -1.507 p-value: .065925 Successes: 3509 z-score: -.639 p-value: .261324 Successes: 3505 z-score: -.822 p-value: .205562 Successes: 3523 z-score: .000 p-value: .500000 Successes: 3526 z-score: .137 p-value: .554479 Successes: 3532 z-score: .411 p-value: .659449 Successes: 3515 z-score: -.365 p-value: .357445 Successes: 3486 z-score: -1.689 p-value: .045562 Successes: 3540 z-score: .776 p-value: .781201 Successes: 3533 z-score: .457 p-value: .676028 square size avg. no. parked sample sigma 100. 3515.900 17.343 KSTEST for the above 10: p= .455932 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: THE MINIMUM DISTANCE TEST :: :: It does this 100 times:: choose n=8000 random points in a :: :: square of side 10000. Find d, the minimum distance between :: :: the (n^2-n)/2 pairs of points. If the points are truly inde- :: :: pendent uniform, then d^2, the square of the minimum distance :: :: should be (very close to) exponentially distributed with mean :: :: .995 . Thus 1-exp(-d^2/.995) should be uniform on [0,1) and :: :: a KSTEST on the resulting 100 values serves as a test of uni- :: :: formity for random points in the square. Test numbers=0 mod 5 :: :: are printed but the KSTEST is based on the full set of 100 :: :: random choices of 8000 points in the 10000x10000 square. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: This is the MINIMUM DISTANCE test for random integers in the file zz_001.bin Sample no. d^2 avg equiv uni 5 .1840 .8821 .168855 10 .1605 .7597 .148989 15 .0649 .6178 .063112 20 .6864 .6985 .498337 25 .1942 .7688 .177303 30 .1130 .8791 .107349 35 3.0485 .9519 .953292 40 .4113 .9704 .338547 45 1.5874 1.0187 .797166 50 .2996 .9552 .260020 55 4.8287 .9965 .992195 60 2.3017 .9880 .901067 65 .6964 .9547 .503352 70 .0857 .9037 .082496 75 .3863 .8665 .321784 80 .0613 .9119 .059778 85 1.6800 .9141 .815188 90 .7438 .9154 .526456 95 .7000 .8906 .505154 100 .3928 .9031 .326200 MINIMUM DISTANCE TEST for zz_001.bin Result of KS test on 20 transformed mindist^2's: p-value= .689732 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: THE 3DSPHERES TEST :: :: Choose 4000 random points in a cube of edge 1000. At each :: :: point, center a sphere large enough to reach the next closest :: :: point. Then the volume of the smallest such sphere is (very :: :: close to) exponentially distributed with mean 120pi/3. Thus :: :: the radius cubed is exponential with mean 30. (The mean is :: :: obtained by extensive simulation). The 3DSPHERES test gener- :: :: ates 4000 such spheres 20 times. Each min radius cubed leads :: :: to a uniform variable by means of 1-exp(-r^3/30.), then a :: :: KSTEST is done on the 20 p-values. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: The 3DSPHERES test for file zz_001.bin sample no: 1 r^3= 11.935 p-value= .32823 sample no: 2 r^3= 61.610 p-value= .87174 sample no: 3 r^3= 6.960 p-value= .20704 sample no: 4 r^3= 12.268 p-value= .33564 sample no: 5 r^3= 31.639 p-value= .65168 sample no: 6 r^3= 5.019 p-value= .15406 sample no: 7 r^3= 21.934 p-value= .51864 sample no: 8 r^3= 1.049 p-value= .03435 sample no: 9 r^3= 16.558 p-value= .42417 sample no: 10 r^3= 14.808 p-value= .38957 sample no: 11 r^3= 26.048 p-value= .58032 sample no: 12 r^3= 3.236 p-value= .10226 sample no: 13 r^3= 97.075 p-value= .96067 sample no: 14 r^3= 40.877 p-value= .74400 sample no: 15 r^3= 14.888 p-value= .39120 sample no: 16 r^3= 3.487 p-value= .10973 sample no: 17 r^3= 18.119 p-value= .45336 sample no: 18 r^3= 7.202 p-value= .21342 sample no: 19 r^3= 23.569 p-value= .54417 sample no: 20 r^3= 4.938 p-value= .15176 A KS test is applied to those 20 p-values. --------------------------------------------------------- 3DSPHERES test for file zz_001.bin p-value= .748093 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the SQEEZE test :: :: Random integers are floated to get uniforms on [0,1). Start- :: :: ing with k=2^31=2147483647, the test finds j, the number of :: :: iterations necessary to reduce k to 1, using the reduction :: :: k=ceiling(k*U), with U provided by floating integers from :: :: the file being tested. Such j's are found 100,000 times, :: :: then counts for the number of times j was <=6,7,...,47,>=48 :: :: are used to provide a chi-square test for cell frequencies. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: RESULTS OF SQUEEZE TEST FOR zz_001.bin Table of standardized frequency counts ( (obs-exp)/sqrt(exp) )^2 for j taking values <=6,7,8,...,47,>=48: -.8 .9 .3 -.8 -1.2 .1 1.4 .3 .9 1.0 -.1 -1.2 -1.5 -.1 1.3 .8 -.5 -.9 -.8 -.1 .1 -.1 .3 1.6 -.8 1.0 -1.3 .3 1.0 .9 -.2 .8 .7 -2.1 -.1 .4 -2.6 .2 .1 -.7 .9 -1.0 .8 Chi-square with 42 degrees of freedom: 38.697 z-score= -.360 p-value= .383041 ______________________________________________________________ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: The OVERLAPPING SUMS test :: :: Integers are floated to get a sequence U(1),U(2),... of uni- :: :: form [0,1) variables. Then overlapping sums, :: :: S(1)=U(1)+...+U(100), S2=U(2)+...+U(101),... are formed. :: :: The S's are virtually normal with a certain covariance mat- :: :: rix. A linear transformation of the S's converts them to a :: :: sequence of independent standard normals, which are converted :: :: to uniform variables for a KSTEST. The p-values from ten :: :: KSTESTs are given still another KSTEST. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Test no. 1 p-value .349057 Test no. 2 p-value .102308 Test no. 3 p-value .821102 Test no. 4 p-value .493713 Test no. 5 p-value .322416 Test no. 6 p-value .930640 Test no. 7 p-value .462340 Test no. 8 p-value .061890 Test no. 9 p-value .146226 Test no. 10 p-value .652443 Results of the OSUM test for zz_001.bin KSTEST on the above 10 p-values: .159417 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the RUNS test. It counts runs up, and runs down, :: :: in a sequence of uniform [0,1) variables, obtained by float- :: :: ing the 32-bit integers in the specified file. This example :: :: shows how runs are counted: .123,.357,.789,.425,.224,.416,.95:: :: contains an up-run of length 3, a down-run of length 2 and an :: :: up-run of (at least) 2, depending on the next values. The :: :: covariance matrices for the runs-up and runs-down are well :: :: known, leading to chisquare tests for quadratic forms in the :: :: weak inverses of the covariance matrices. Runs are counted :: :: for sequences of length 10,000. This is done ten times. Then :: :: repeated. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: The RUNS test for file zz_001.bin Up and down runs in a sample of 10000 _________________________________________________ Run test for zz_001.bin : runs up; ks test for 10 p's: .312572 runs down; ks test for 10 p's: .335418 Run test for zz_001.bin : runs up; ks test for 10 p's: .584999 runs down; ks test for 10 p's: .855489 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the CRAPS TEST. It plays 200,000 games of craps, finds:: :: the number of wins and the number of throws necessary to end :: :: each game. The number of wins should be (very close to) a :: :: normal with mean 200000p and variance 200000p(1-p), with :: :: p=244/495. Throws necessary to complete the game can vary :: :: from 1 to infinity, but counts for all>21 are lumped with 21. :: :: A chi-square test is made on the no.-of-throws cell counts. :: :: Each 32-bit integer from the test file provides the value for :: :: the throw of a die, by floating to [0,1), multiplying by 6 :: :: and taking 1 plus the integer part of the result. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Results of craps test for zz_001.bin No. of wins: Observed Expected 98411 98585.86 98411= No. of wins, z-score= -.782 pvalue= .21709 Analysis of Throws-per-Game: Chisq= 17.84 for 20 degrees of freedom, p= .40220 Throws Observed Expected Chisq Sum 1 66568 66666.7 .146 .146 2 37746 37654.3 .223 .369 3 26981 26954.7 .026 .395 4 19562 19313.5 3.198 3.593 5 13602 13851.4 4.491 8.084 6 9862 9943.5 .669 8.753 7 7179 7145.0 .162 8.915 8 5266 5139.1 3.135 12.050 9 3679 3699.9 .118 12.167 10 2656 2666.3 .040 12.207 11 1906 1923.3 .156 12.363 12 1386 1388.7 .005 12.369 13 995 1003.7 .076 12.444 14 748 726.1 .658 13.102 15 489 525.8 2.580 15.683 16 356 381.2 1.660 17.342 17 275 276.5 .009 17.351 18 209 200.8 .332 17.683 19 148 146.0 .028 17.711 20 103 106.2 .097 17.808 21 284 287.1 .034 17.842 SUMMARY FOR zz_001.bin p-value for no. of wins: .217086 p-value for throws/game: .402200 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Results of DIEHARD battery of tests sent to file zz_001.die