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 block4.rng For a sample of size 500: mean block4.rng using bits 1 to 24 2.042 duplicate number number spacings observed expected 0 69. 67.668 1 147. 135.335 2 104. 135.335 3 107. 90.224 4 38. 45.112 5 23. 18.045 6 to INF 12. 8.282 Chisquare with 6 d.o.f. = 15.56 p-value= .983664 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block4.rng using bits 2 to 25 1.932 duplicate number number spacings observed expected 0 75. 67.668 1 136. 135.335 2 134. 135.335 3 95. 90.224 4 35. 45.112 5 16. 18.045 6 to INF 9. 8.282 Chisquare with 6 d.o.f. = 3.62 p-value= .272641 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block4.rng using bits 3 to 26 1.920 duplicate number number spacings observed expected 0 76. 67.668 1 140. 135.335 2 135. 135.335 3 78. 90.224 4 52. 45.112 5 9. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = 8.79 p-value= .813994 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block4.rng using bits 4 to 27 2.114 duplicate number number spacings observed expected 0 58. 67.668 1 122. 135.335 2 143. 135.335 3 102. 90.224 4 50. 45.112 5 15. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = 6.07 p-value= .584197 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block4.rng using bits 5 to 28 1.988 duplicate number number spacings observed expected 0 58. 67.668 1 150. 135.335 2 136. 135.335 3 85. 90.224 4 49. 45.112 5 13. 18.045 6 to INF 9. 8.282 Chisquare with 6 d.o.f. = 5.08 p-value= .466874 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block4.rng using bits 6 to 29 1.976 duplicate number number spacings observed expected 0 57. 67.668 1 148. 135.335 2 132. 135.335 3 105. 90.224 4 37. 45.112 5 15. 18.045 6 to INF 6. 8.282 Chisquare with 6 d.o.f. = 7.97 p-value= .759703 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block4.rng using bits 7 to 30 1.950 duplicate number number spacings observed expected 0 72. 67.668 1 130. 135.335 2 140. 135.335 3 100. 90.224 4 35. 45.112 5 14. 18.045 6 to INF 9. 8.282 Chisquare with 6 d.o.f. = 4.94 p-value= .448894 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block4.rng using bits 8 to 31 2.024 duplicate number number spacings observed expected 0 65. 67.668 1 141. 135.335 2 126. 135.335 3 88. 90.224 4 55. 45.112 5 18. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 3.41 p-value= .243695 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block4.rng using bits 9 to 32 2.116 duplicate number number spacings observed expected 0 56. 67.668 1 134. 135.335 2 141. 135.335 3 86. 90.224 4 48. 45.112 5 24. 18.045 6 to INF 11. 8.282 Chisquare with 6 d.o.f. = 5.50 p-value= .518819 ::::::::::::::::::::::::::::::::::::::::: The 9 p-values were .983664 .272641 .813994 .584197 .466874 .759703 .448894 .243695 .518819 A KSTEST for the 9 p-values yields .373832 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block4.rng For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=106.939; p-value= .724796 OPERM5 test for file block4.rng For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom= 98.789; p-value= .512905 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block4.rng 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 216 211.4 .099304 .099 29 5054 5134.0 1.246908 1.346 30 23077 23103.0 .029366 1.376 31 11653 11551.5 .891423 2.267 chisquare= 2.267 for 3 d. of f.; p-value= .547206 -------------------------------------------------------------- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block4.rng 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 220 211.4 .348364 .348 30 5067 5134.0 .874633 1.223 31 23016 23103.0 .327972 1.551 32 11697 11551.5 1.832065 3.383 chisquare= 3.383 for 3 d. of f.; p-value= .696684 -------------------------------------------------------------- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block4.rng Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 1 to 8 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 997 944.3 2.941 2.941 r =5 21793 21743.9 .111 3.052 r =6 77210 77311.8 .134 3.186 p=1-exp(-SUM/2)= .79667 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 2 to 9 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 952 944.3 .063 .063 r =5 21798 21743.9 .135 .197 r =6 77250 77311.8 .049 .247 p=1-exp(-SUM/2)= .11608 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 3 to 10 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 929 944.3 .248 .248 r =5 22135 21743.9 7.035 7.283 r =6 76936 77311.8 1.827 9.109 p=1-exp(-SUM/2)= .98948 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 4 to 11 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 985 944.3 1.754 1.754 r =5 22045 21743.9 4.169 5.924 r =6 76970 77311.8 1.511 7.435 p=1-exp(-SUM/2)= .97570 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 5 to 12 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 979 944.3 1.275 1.275 r =5 21831 21743.9 .349 1.624 r =6 77190 77311.8 .192 1.816 p=1-exp(-SUM/2)= .59663 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 6 to 13 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 959 944.3 .229 .229 r =5 21977 21743.9 2.499 2.728 r =6 77064 77311.8 .794 3.522 p=1-exp(-SUM/2)= .82812 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 7 to 14 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 999 944.3 3.168 3.168 r =5 21794 21743.9 .115 3.284 r =6 77207 77311.8 .142 3.426 p=1-exp(-SUM/2)= .81967 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 8 to 15 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 902 944.3 1.895 1.895 r =5 21537 21743.9 1.969 3.864 r =6 77561 77311.8 .803 4.667 p=1-exp(-SUM/2)= .90304 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 9 to 16 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 898 944.3 2.270 2.270 r =5 21536 21743.9 1.988 4.258 r =6 77566 77311.8 .836 5.094 p=1-exp(-SUM/2)= .92168 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 10 to 17 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 979 944.3 1.275 1.275 r =5 21540 21743.9 1.912 3.187 r =6 77481 77311.8 .370 3.557 p=1-exp(-SUM/2)= .83114 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 11 to 18 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 981 944.3 1.426 1.426 r =5 21722 21743.9 .022 1.448 r =6 77297 77311.8 .003 1.451 p=1-exp(-SUM/2)= .51595 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 12 to 19 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 920 944.3 .625 .625 r =5 21889 21743.9 .968 1.594 r =6 77191 77311.8 .189 1.782 p=1-exp(-SUM/2)= .58984 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 13 to 20 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 891 944.3 3.009 3.009 r =5 21939 21743.9 1.751 4.759 r =6 77170 77311.8 .260 5.019 p=1-exp(-SUM/2)= .91870 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 14 to 21 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 887 944.3 3.477 3.477 r =5 21797 21743.9 .130 3.607 r =6 77316 77311.8 .000 3.607 p=1-exp(-SUM/2)= .83528 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 15 to 22 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 986 944.3 1.841 1.841 r =5 21688 21743.9 .144 1.985 r =6 77326 77311.8 .003 1.988 p=1-exp(-SUM/2)= .62984 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 16 to 23 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 989 944.3 2.116 2.116 r =5 22011 21743.9 3.281 5.397 r =6 77000 77311.8 1.258 6.654 p=1-exp(-SUM/2)= .96411 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 17 to 24 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 995 944.3 2.722 2.722 r =5 21909 21743.9 1.254 3.976 r =6 77096 77311.8 .602 4.578 p=1-exp(-SUM/2)= .89863 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 18 to 25 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 947 944.3 .008 .008 r =5 21764 21743.9 .019 .026 r =6 77289 77311.8 .007 .033 p=1-exp(-SUM/2)= .01637 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 19 to 26 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 966 944.3 .499 .499 r =5 21799 21743.9 .140 .638 r =6 77235 77311.8 .076 .715 p=1-exp(-SUM/2)= .30041 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 20 to 27 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 893 944.3 2.787 2.787 r =5 21930 21743.9 1.593 4.380 r =6 77177 77311.8 .235 4.615 p=1-exp(-SUM/2)= .90048 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 21 to 28 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 924 944.3 .436 .436 r =5 21827 21743.9 .318 .754 r =6 77249 77311.8 .051 .805 p=1-exp(-SUM/2)= .33137 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 22 to 29 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 953 944.3 .080 .080 r =5 21853 21743.9 .547 .628 r =6 77194 77311.8 .180 .807 p=1-exp(-SUM/2)= .33204 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 23 to 30 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 974 944.3 .934 .934 r =5 21770 21743.9 .031 .965 r =6 77256 77311.8 .040 1.006 p=1-exp(-SUM/2)= .39518 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 24 to 31 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 924 944.3 .436 .436 r =5 21633 21743.9 .566 1.002 r =6 77443 77311.8 .223 1.225 p=1-exp(-SUM/2)= .45793 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block4.rng b-rank test for bits 25 to 32 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 974 944.3 .934 .934 r =5 21564 21743.9 1.488 2.422 r =6 77462 77311.8 .292 2.714 p=1-exp(-SUM/2)= .74260 TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices These should be 25 uniform [0,1] random variables: .796674 .116079 .989482 .975702 .596633 .828123 .819670 .903039 .921677 .831138 .515949 .589840 .918701 .835279 .629844 .964106 .898630 .016374 .300413 .900484 .331373 .332036 .395180 .457927 .742600 brank test summary for block4.rng The KS test for those 25 supposed UNI's yields KS p-value= .995650 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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: 141285 missing words, -1.46 sigmas from mean, p-value= .07232 tst no 2: 141829 missing words, -.19 sigmas from mean, p-value= .42556 tst no 3: 141483 missing words, -1.00 sigmas from mean, p-value= .15960 tst no 4: 141640 missing words, -.63 sigmas from mean, p-value= .26459 tst no 5: 141890 missing words, -.05 sigmas from mean, p-value= .48199 tst no 6: 142712 missing words, 1.88 sigmas from mean, p-value= .96963 tst no 7: 142068 missing words, .37 sigmas from mean, p-value= .64458 tst no 8: 141390 missing words, -1.21 sigmas from mean, p-value= .11249 tst no 9: 141436 missing words, -1.11 sigmas from mean, p-value= .13438 tst no 10: 141522 missing words, -.90 sigmas from mean, p-value= .18274 tst no 11: 142186 missing words, .65 sigmas from mean, p-value= .74100 tst no 12: 141419 missing words, -1.15 sigmas from mean, p-value= .12597 tst no 13: 141850 missing words, -.14 sigmas from mean, p-value= .44488 tst no 14: 142004 missing words, .22 sigmas from mean, p-value= .58753 tst no 15: 141425 missing words, -1.13 sigmas from mean, p-value= .12890 tst no 16: 142197 missing words, .67 sigmas from mean, p-value= .74925 tst no 17: 141595 missing words, -.73 sigmas from mean, p-value= .23135 tst no 18: 141883 missing words, -.06 sigmas from mean, p-value= .47547 tst no 19: 141233 missing words, -1.58 sigmas from mean, p-value= .05703 tst no 20: 141844 missing words, -.15 sigmas from mean, p-value= .43934 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block4.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OPSO for block4.rng using bits 23 to 32 142673 2.633 .9958 OPSO for block4.rng using bits 22 to 31 142082 .595 .7242 OPSO for block4.rng using bits 21 to 30 141722 -.646 .2592 OPSO for block4.rng using bits 20 to 29 141657 -.870 .1921 OPSO for block4.rng using bits 19 to 28 142015 .364 .6422 OPSO for block4.rng using bits 18 to 27 141571 -1.167 .1217 OPSO for block4.rng using bits 17 to 26 141972 .216 .5855 OPSO for block4.rng using bits 16 to 25 142409 1.723 .9576 OPSO for block4.rng using bits 15 to 24 142098 .651 .7423 OPSO for block4.rng using bits 14 to 23 142127 .751 .7736 OPSO for block4.rng using bits 13 to 22 142402 1.699 .9553 OPSO for block4.rng using bits 12 to 21 141893 -.056 .4775 OPSO for block4.rng using bits 11 to 20 142448 1.857 .9684 OPSO for block4.rng using bits 10 to 19 142081 .592 .7231 OPSO for block4.rng using bits 9 to 18 141887 -.077 .4693 OPSO for block4.rng using bits 8 to 17 141902 -.025 .4899 OPSO for block4.rng using bits 7 to 16 141934 .085 .5339 OPSO for block4.rng using bits 6 to 15 141341 -1.960 .0250 OPSO for block4.rng using bits 5 to 14 141717 -.663 .2536 OPSO for block4.rng using bits 4 to 13 142229 1.102 .8648 OPSO for block4.rng using bits 3 to 12 141961 .178 .5707 OPSO for block4.rng using bits 2 to 11 142307 1.371 .9149 OPSO for block4.rng using bits 1 to 10 141882 -.094 .4625 OQSO test for generator block4.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OQSO for block4.rng using bits 28 to 32 141386 -1.774 .0380 OQSO for block4.rng using bits 27 to 31 141746 -.554 .2899 OQSO for block4.rng using bits 26 to 30 142032 .416 .6612 OQSO for block4.rng using bits 25 to 29 141764 -.493 .3111 OQSO for block4.rng using bits 24 to 28 141991 .277 .6091 OQSO for block4.rng using bits 23 to 27 141616 -.994 .1600 OQSO for block4.rng using bits 22 to 26 141331 -1.960 .0250 OQSO for block4.rng using bits 21 to 25 141591 -1.079 .1403 OQSO for block4.rng using bits 20 to 24 141644 -.899 .1842 OQSO for block4.rng using bits 19 to 23 142023 .385 .6500 OQSO for block4.rng using bits 18 to 22 141337 -1.940 .0262 OQSO for block4.rng using bits 17 to 21 142304 1.338 .9095 OQSO for block4.rng using bits 16 to 20 142022 .382 .6487 OQSO for block4.rng using bits 15 to 19 141933 .080 .5320 OQSO for block4.rng using bits 14 to 18 141810 -.337 .3682 OQSO for block4.rng using bits 13 to 17 142403 1.673 .9529 OQSO for block4.rng using bits 12 to 16 142252 1.162 .8773 OQSO for block4.rng using bits 11 to 15 142016 .362 .6412 OQSO for block4.rng using bits 10 to 14 141487 -1.432 .0761 OQSO for block4.rng using bits 9 to 13 141672 -.805 .2106 OQSO for block4.rng using bits 8 to 12 141431 -1.621 .0525 OQSO for block4.rng using bits 7 to 11 141849 -.205 .4190 OQSO for block4.rng using bits 6 to 10 141523 -1.310 .0952 OQSO for block4.rng using bits 5 to 9 142546 2.158 .9845 OQSO for block4.rng using bits 4 to 8 142079 .575 .7174 OQSO for block4.rng using bits 3 to 7 141920 .036 .5144 OQSO for block4.rng using bits 2 to 6 142015 .358 .6399 OQSO for block4.rng using bits 1 to 5 141813 -.327 .3720 DNA test for generator block4.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p DNA for block4.rng using bits 31 to 32 142118 .616 .7309 DNA for block4.rng using bits 30 to 31 142456 1.613 .9466 DNA for block4.rng using bits 29 to 30 141915 .017 .5067 DNA for block4.rng using bits 28 to 29 141888 -.063 .4749 DNA for block4.rng using bits 27 to 28 142278 1.088 .8616 DNA for block4.rng using bits 26 to 27 142398 1.442 .9253 DNA for block4.rng using bits 25 to 26 141698 -.623 .2665 DNA for block4.rng using bits 24 to 25 142306 1.170 .8790 DNA for block4.rng using bits 23 to 24 142123 .630 .7358 DNA for block4.rng using bits 22 to 23 142329 1.238 .8921 DNA for block4.rng using bits 21 to 22 141377 -1.570 .0582 DNA for block4.rng using bits 20 to 21 142162 .745 .7720 DNA for block4.rng using bits 19 to 20 141743 -.491 .3118 DNA for block4.rng using bits 18 to 19 141916 .020 .5079 DNA for block4.rng using bits 17 to 18 142169 .766 .7782 DNA for block4.rng using bits 16 to 17 141629 -.827 .2041 DNA for block4.rng using bits 15 to 16 141782 -.376 .3536 DNA for block4.rng using bits 14 to 15 142153 .719 .7639 DNA for block4.rng using bits 13 to 14 142201 .860 .8052 DNA for block4.rng using bits 12 to 13 141920 .031 .5126 DNA for block4.rng using bits 11 to 12 142227 .937 .8256 DNA for block4.rng using bits 10 to 11 142588 2.002 .9774 DNA for block4.rng using bits 9 to 10 141927 .052 .5208 DNA for block4.rng using bits 8 to 9 141905 -.013 .4949 DNA for block4.rng using bits 7 to 8 141491 -1.234 .1086 DNA for block4.rng using bits 6 to 7 142005 .282 .6111 DNA for block4.rng using bits 5 to 6 142228 .940 .8264 DNA for block4.rng using bits 4 to 5 141654 -.753 .2257 DNA for block4.rng using bits 3 to 4 142163 .748 .7729 DNA for block4.rng using bits 2 to 3 142142 .686 .7538 DNA for block4.rng using bits 1 to 2 142035 .371 .6446 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block4.rng 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 block4.rng 2448.79 -.724 .234453 byte stream for block4.rng 2432.88 -.949 .171271 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 2475.21 -.351 .362958 bits 2 to 9 2482.52 -.247 .402366 bits 3 to 10 2638.34 1.956 .974796 bits 4 to 11 2528.06 .397 .654256 bits 5 to 12 2473.52 -.375 .354010 bits 6 to 13 2475.82 -.342 .366174 bits 7 to 14 2492.27 -.109 .456466 bits 8 to 15 2502.12 .030 .511973 bits 9 to 16 2561.13 .865 .806365 bits 10 to 17 2496.56 -.049 .480585 bits 11 to 18 2471.19 -.408 .341818 bits 12 to 19 2496.23 -.053 .478756 bits 13 to 20 2499.48 -.007 .497068 bits 14 to 21 2439.40 -.857 .195723 bits 15 to 22 2468.71 -.443 .329055 bits 16 to 23 2469.37 -.433 .332431 bits 17 to 24 2517.06 .241 .595329 bits 18 to 25 2556.00 .792 .785821 bits 19 to 26 2502.17 .031 .512268 bits 20 to 27 2439.86 -.851 .197505 bits 21 to 28 2523.74 .336 .631465 bits 22 to 29 2594.99 1.343 .910422 bits 23 to 30 2466.27 -.477 .316674 bits 24 to 31 2513.49 .191 .575654 bits 25 to 32 2519.88 .281 .610725 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block4.rng Of 12,000 tries, the average no. of successes should be 3523 with sigma=21.9 Successes: 3508 z-score: -.685 p-value: .246694 Successes: 3536 z-score: .594 p-value: .723613 Successes: 3532 z-score: .411 p-value: .659449 Successes: 3540 z-score: .776 p-value: .781201 Successes: 3520 z-score: -.137 p-value: .445521 Successes: 3511 z-score: -.548 p-value: .291865 Successes: 3470 z-score: -2.420 p-value: .007758 Successes: 3549 z-score: 1.187 p-value: .882429 Successes: 3528 z-score: .228 p-value: .590298 Successes: 3518 z-score: -.228 p-value: .409702 square size avg. no. parked sample sigma 100. 3521.200 21.018 KSTEST for the above 10: p= .108721 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block4.rng Sample no. d^2 avg equiv uni 5 1.6292 1.3676 .805505 10 3.8078 1.8245 .978223 15 .6531 1.3694 .481281 20 .3982 1.1326 .329785 25 .7857 1.0973 .546014 30 3.3993 1.2014 .967169 35 .3990 1.0973 .330366 40 .1931 1.1490 .176409 45 .8038 1.0844 .554174 50 .0588 1.0096 .057397 55 1.4598 .9823 .769418 60 .5192 .9575 .406552 65 .9622 1.0115 .619781 70 3.6999 1.0399 .975729 75 2.1256 1.0136 .881904 80 .0657 .9929 .063905 85 .3357 1.0291 .286383 90 2.8616 1.0488 .943640 95 1.9800 1.0975 .863294 100 .1482 1.0511 .138368 MINIMUM DISTANCE TEST for block4.rng Result of KS test on 20 transformed mindist^2's: p-value= .524298 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block4.rng sample no: 1 r^3= 22.859 p-value= .53325 sample no: 2 r^3= 2.518 p-value= .08052 sample no: 3 r^3= 2.226 p-value= .07150 sample no: 4 r^3= 19.656 p-value= .48067 sample no: 5 r^3= 7.559 p-value= .22274 sample no: 6 r^3= 1.100 p-value= .03600 sample no: 7 r^3= 6.911 p-value= .20575 sample no: 8 r^3= 28.342 p-value= .61122 sample no: 9 r^3= 22.012 p-value= .51988 sample no: 10 r^3= 10.309 p-value= .29081 sample no: 11 r^3= 68.051 p-value= .89652 sample no: 12 r^3= 16.500 p-value= .42305 sample no: 13 r^3= 31.768 p-value= .65317 sample no: 14 r^3= 36.106 p-value= .69987 sample no: 15 r^3= 20.741 p-value= .49911 sample no: 16 r^3= 2.906 p-value= .09231 sample no: 17 r^3= 43.456 p-value= .76509 sample no: 18 r^3= 16.930 p-value= .43126 sample no: 19 r^3= 6.718 p-value= .20063 sample no: 20 r^3= 55.060 p-value= .84044 A KS test is applied to those 20 p-values. --------------------------------------------------------- 3DSPHERES test for file block4.rng p-value= .564876 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block4.rng Table of standardized frequency counts ( (obs-exp)/sqrt(exp) )^2 for j taking values <=6,7,8,...,47,>=48: .6 -1.2 .8 .8 -.1 .3 -.1 .2 1.4 -.8 -.2 -1.5 -1.6 -.2 -1.3 .8 -.1 .1 -.5 1.7 .5 .3 1.1 1.2 -.8 -.7 -1.4 .9 1.6 .0 -1.0 -1.0 1.4 .1 .9 1.5 .0 -1.0 -1.2 2.6 .1 .0 1.8 Chi-square with 42 degrees of freedom: 45.074 z-score= .335 p-value= .655516 ______________________________________________________________ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 .303030 Test no. 2 p-value .396281 Test no. 3 p-value .628466 Test no. 4 p-value .047756 Test no. 5 p-value .284294 Test no. 6 p-value .225097 Test no. 7 p-value .904057 Test no. 8 p-value .596582 Test no. 9 p-value .050642 Test no. 10 p-value .713517 Results of the OSUM test for block4.rng KSTEST on the above 10 p-values: .390328 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block4.rng Up and down runs in a sample of 10000 _________________________________________________ Run test for block4.rng : runs up; ks test for 10 p's: .057743 runs down; ks test for 10 p's: .306001 Run test for block4.rng : runs up; ks test for 10 p's: .999245 runs down; ks test for 10 p's: .668036 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block4.rng No. of wins: Observed Expected 98616 98585.86 98616= No. of wins, z-score= .135 pvalue= .55362 Analysis of Throws-per-Game: Chisq= 20.73 for 20 degrees of freedom, p= .58697 Throws Observed Expected Chisq Sum 1 66428 66666.7 .854 .854 2 37432 37654.3 1.313 2.167 3 27005 26954.7 .094 2.261 4 19625 19313.5 5.025 7.286 5 14047 13851.4 2.762 10.048 6 9955 9943.5 .013 10.061 7 7117 7145.0 .110 10.171 8 5119 5139.1 .078 10.249 9 3638 3699.9 1.034 11.284 10 2672 2666.3 .012 11.296 11 1968 1923.3 1.038 12.333 12 1357 1388.7 .725 13.059 13 992 1003.7 .137 13.196 14 765 726.1 2.080 15.275 15 512 525.8 .364 15.639 16 379 381.2 .012 15.651 17 273 276.5 .045 15.697 18 173 200.8 3.856 19.553 19 158 146.0 .989 20.542 20 105 106.2 .014 20.556 21 280 287.1 .176 20.732 SUMMARY FOR block4.rng p-value for no. of wins: .553618 p-value for throws/game: .586970 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Results of DIEHARD battery of tests sent to file report4.txt