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 block5.rng For a sample of size 500: mean block5.rng using bits 1 to 24 2.166 duplicate number number spacings observed expected 0 57. 67.668 1 138. 135.335 2 121. 135.335 3 94. 90.224 4 51. 45.112 5 25. 18.045 6 to INF 14. 8.282 Chisquare with 6 d.o.f. = 10.81 p-value= .905516 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block5.rng using bits 2 to 25 2.086 duplicate number number spacings observed expected 0 66. 67.668 1 137. 135.335 2 120. 135.335 3 92. 90.224 4 48. 45.112 5 26. 18.045 6 to INF 11. 8.282 Chisquare with 6 d.o.f. = 6.42 p-value= .622026 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block5.rng using bits 3 to 26 2.064 duplicate number number spacings observed expected 0 58. 67.668 1 141. 135.335 2 117. 135.335 3 114. 90.224 4 45. 45.112 5 17. 18.045 6 to INF 8. 8.282 Chisquare with 6 d.o.f. = 10.44 p-value= .892641 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block5.rng using bits 4 to 27 1.978 duplicate number number spacings observed expected 0 68. 67.668 1 147. 135.335 2 131. 135.335 3 82. 90.224 4 44. 45.112 5 18. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = 2.28 p-value= .107709 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block5.rng using bits 5 to 28 1.912 duplicate number number spacings observed expected 0 73. 67.668 1 140. 135.335 2 137. 135.335 3 80. 90.224 4 54. 45.112 5 11. 18.045 6 to INF 5. 8.282 Chisquare with 6 d.o.f. = 7.56 p-value= .728012 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block5.rng using bits 6 to 29 1.910 duplicate number number spacings observed expected 0 86. 67.668 1 125. 135.335 2 130. 135.335 3 99. 90.224 4 36. 45.112 5 18. 18.045 6 to INF 6. 8.282 Chisquare with 6 d.o.f. = 9.29 p-value= .842040 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block5.rng using bits 7 to 30 2.026 duplicate number number spacings observed expected 0 66. 67.668 1 136. 135.335 2 145. 135.335 3 80. 90.224 4 43. 45.112 5 11. 18.045 6 to INF 19. 8.282 Chisquare with 6 d.o.f. = 18.61 p-value= .995131 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block5.rng using bits 8 to 31 1.992 duplicate number number spacings observed expected 0 57. 67.668 1 143. 135.335 2 142. 135.335 3 94. 90.224 4 36. 45.112 5 25. 18.045 6 to INF 3. 8.282 Chisquare with 6 d.o.f. = 10.49 p-value= .894594 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block5.rng using bits 9 to 32 1.996 duplicate number number spacings observed expected 0 56. 67.668 1 146. 135.335 2 137. 135.335 3 95. 90.224 4 45. 45.112 5 14. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 4.23 p-value= .354530 ::::::::::::::::::::::::::::::::::::::::: The 9 p-values were .905516 .622026 .892641 .107709 .728012 .842040 .995131 .894594 .354530 A KSTEST for the 9 p-values yields .969266 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block5.rng For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=110.661; p-value= .801085 OPERM5 test for file block5.rng For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=105.649; p-value= .694874 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block5.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 196 211.4 1.124385 1.124 29 5165 5134.0 .187059 1.311 30 23016 23103.0 .327972 1.639 31 11623 11551.5 .442258 2.082 chisquare= 2.082 for 3 d. of f.; p-value= .518910 -------------------------------------------------------------- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block5.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 204 211.4 .260276 .260 30 5195 5134.0 .724531 .985 31 23136 23103.0 .047003 1.032 32 11465 11551.5 .648094 1.680 chisquare= 1.680 for 3 d. of f.; p-value= .456058 -------------------------------------------------------------- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block5.rng Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 1 to 8 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 962 944.3 .332 .332 r =5 21694 21743.9 .115 .446 r =6 77344 77311.8 .013 .460 p=1-exp(-SUM/2)= .20533 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 2 to 9 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 953 944.3 .080 .080 r =5 21949 21743.9 1.935 2.015 r =6 77098 77311.8 .591 2.606 p=1-exp(-SUM/2)= .72829 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 3 to 10 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 912 944.3 1.105 1.105 r =5 21553 21743.9 1.676 2.781 r =6 77535 77311.8 .644 3.425 p=1-exp(-SUM/2)= .81961 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 4 to 11 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 921 944.3 .575 .575 r =5 21655 21743.9 .363 .938 r =6 77424 77311.8 .163 1.101 p=1-exp(-SUM/2)= .42341 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 5 to 12 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 894 944.3 2.679 2.679 r =5 21551 21743.9 1.711 4.391 r =6 77555 77311.8 .765 5.156 p=1-exp(-SUM/2)= .92407 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 6 to 13 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 927 944.3 .317 .317 r =5 21643 21743.9 .468 .785 r =6 77430 77311.8 .181 .966 p=1-exp(-SUM/2)= .38304 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 7 to 14 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 926 944.3 .355 .355 r =5 21609 21743.9 .837 1.192 r =6 77465 77311.8 .304 1.495 p=1-exp(-SUM/2)= .52649 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 8 to 15 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 976 944.3 1.064 1.064 r =5 21939 21743.9 1.751 2.815 r =6 77085 77311.8 .665 3.480 p=1-exp(-SUM/2)= .82448 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 9 to 16 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 929 944.3 .248 .248 r =5 21718 21743.9 .031 .279 r =6 77353 77311.8 .022 .301 p=1-exp(-SUM/2)= .13961 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 10 to 17 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 943 944.3 .002 .002 r =5 21843 21743.9 .452 .453 r =6 77214 77311.8 .124 .577 p=1-exp(-SUM/2)= .25068 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 11 to 18 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 955 944.3 .121 .121 r =5 21837 21743.9 .399 .520 r =6 77208 77311.8 .139 .659 p=1-exp(-SUM/2)= .28079 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 12 to 19 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 918 944.3 .733 .733 r =5 21864 21743.9 .663 1.396 r =6 77218 77311.8 .114 1.510 p=1-exp(-SUM/2)= .52993 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 13 to 20 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 926 944.3 .355 .355 r =5 21828 21743.9 .325 .680 r =6 77246 77311.8 .056 .736 p=1-exp(-SUM/2)= .30788 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 14 to 21 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 954 944.3 .100 .100 r =5 21781 21743.9 .063 .163 r =6 77265 77311.8 .028 .191 p=1-exp(-SUM/2)= .09119 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 15 to 22 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 985 944.3 1.754 1.754 r =5 21660 21743.9 .324 2.078 r =6 77355 77311.8 .024 2.102 p=1-exp(-SUM/2)= .65040 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 16 to 23 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 958 944.3 .199 .199 r =5 21737 21743.9 .002 .201 r =6 77305 77311.8 .001 .202 p=1-exp(-SUM/2)= .09585 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 17 to 24 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 941 944.3 .012 .012 r =5 21786 21743.9 .082 .093 r =6 77273 77311.8 .019 .113 p=1-exp(-SUM/2)= .05471 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 18 to 25 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 998 944.3 3.054 3.054 r =5 21837 21743.9 .399 3.452 r =6 77165 77311.8 .279 3.731 p=1-exp(-SUM/2)= .84518 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 19 to 26 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 955 944.3 .121 .121 r =5 21906 21743.9 1.208 1.330 r =6 77139 77311.8 .386 1.716 p=1-exp(-SUM/2)= .57597 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 20 to 27 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1003 944.3 3.649 3.649 r =5 21713 21743.9 .044 3.693 r =6 77284 77311.8 .010 3.703 p=1-exp(-SUM/2)= .84297 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 21 to 28 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 980 944.3 1.350 1.350 r =5 21684 21743.9 .165 1.515 r =6 77336 77311.8 .008 1.522 p=1-exp(-SUM/2)= .53284 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 22 to 29 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 950 944.3 .034 .034 r =5 21782 21743.9 .067 .101 r =6 77268 77311.8 .025 .126 p=1-exp(-SUM/2)= .06104 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 23 to 30 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 954 944.3 .100 .100 r =5 21868 21743.9 .708 .808 r =6 77178 77311.8 .232 1.039 p=1-exp(-SUM/2)= .40532 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 24 to 31 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 998 944.3 3.054 3.054 r =5 21666 21743.9 .279 3.333 r =6 77336 77311.8 .008 3.340 p=1-exp(-SUM/2)= .81178 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block5.rng b-rank test for bits 25 to 32 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 937 944.3 .056 .056 r =5 21604 21743.9 .900 .957 r =6 77459 77311.8 .280 1.237 p=1-exp(-SUM/2)= .46120 TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices These should be 25 uniform [0,1] random variables: .205326 .728286 .819611 .423415 .924066 .383041 .526494 .824479 .139611 .250680 .280792 .529926 .307875 .091195 .650404 .095847 .054711 .845183 .575971 .842974 .532837 .061042 .405322 .811781 .461200 brank test summary for block5.rng The KS test for those 25 supposed UNI's yields KS p-value= .147032 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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: 142436 missing words, 1.23 sigmas from mean, p-value= .89075 tst no 2: 141476 missing words, -1.01 sigmas from mean, p-value= .15566 tst no 3: 141961 missing words, .12 sigmas from mean, p-value= .54805 tst no 4: 141534 missing words, -.88 sigmas from mean, p-value= .19026 tst no 5: 141862 missing words, -.11 sigmas from mean, p-value= .45597 tst no 6: 141509 missing words, -.94 sigmas from mean, p-value= .17480 tst no 7: 141257 missing words, -1.52 sigmas from mean, p-value= .06374 tst no 8: 141885 missing words, -.06 sigmas from mean, p-value= .47734 tst no 9: 141996 missing words, .20 sigmas from mean, p-value= .58024 tst no 10: 142092 missing words, .43 sigmas from mean, p-value= .66524 tst no 11: 142101 missing words, .45 sigmas from mean, p-value= .67286 tst no 12: 141722 missing words, -.44 sigmas from mean, p-value= .33081 tst no 13: 141687 missing words, -.52 sigmas from mean, p-value= .30172 tst no 14: 141570 missing words, -.79 sigmas from mean, p-value= .21394 tst no 15: 142299 missing words, .91 sigmas from mean, p-value= .81871 tst no 16: 142034 missing words, .29 sigmas from mean, p-value= .61458 tst no 17: 141515 missing words, -.92 sigmas from mean, p-value= .17844 tst no 18: 142247 missing words, .79 sigmas from mean, p-value= .78493 tst no 19: 142131 missing words, .52 sigmas from mean, p-value= .69774 tst no 20: 141383 missing words, -1.23 sigmas from mean, p-value= .10940 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block5.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OPSO for block5.rng using bits 23 to 32 141425 -1.670 .0475 OPSO for block5.rng using bits 22 to 31 141973 .220 .5869 OPSO for block5.rng using bits 21 to 30 141694 -.743 .2289 OPSO for block5.rng using bits 20 to 29 142800 3.071 .9989 OPSO for block5.rng using bits 19 to 28 141799 -.380 .3518 OPSO for block5.rng using bits 18 to 27 142180 .933 .8247 OPSO for block5.rng using bits 17 to 26 142165 .882 .8110 OPSO for block5.rng using bits 16 to 25 141407 -1.732 .0416 OPSO for block5.rng using bits 15 to 24 141704 -.708 .2395 OPSO for block5.rng using bits 14 to 23 141730 -.618 .2682 OPSO for block5.rng using bits 13 to 22 141674 -.811 .2085 OPSO for block5.rng using bits 12 to 21 142063 .530 .7019 OPSO for block5.rng using bits 11 to 20 141980 .244 .5963 OPSO for block5.rng using bits 10 to 19 142301 1.351 .9116 OPSO for block5.rng using bits 9 to 18 141937 .095 .5380 OPSO for block5.rng using bits 8 to 17 142101 .661 .7457 OPSO for block5.rng using bits 7 to 16 141883 -.091 .4638 OPSO for block5.rng using bits 6 to 15 141656 -.874 .1912 OPSO for block5.rng using bits 5 to 14 142344 1.499 .9330 OPSO for block5.rng using bits 4 to 13 142220 1.071 .8580 OPSO for block5.rng using bits 3 to 12 141936 .092 .5366 OPSO for block5.rng using bits 2 to 11 142459 1.895 .9710 OPSO for block5.rng using bits 1 to 10 141754 -.536 .2961 OQSO test for generator block5.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OQSO for block5.rng using bits 28 to 32 141762 -.499 .3087 OQSO for block5.rng using bits 27 to 31 141266 -2.181 .0146 OQSO for block5.rng using bits 26 to 30 141987 .263 .6038 OQSO for block5.rng using bits 25 to 29 141623 -.971 .1659 OQSO for block5.rng using bits 24 to 28 141769 -.476 .3171 OQSO for block5.rng using bits 23 to 27 141927 .060 .5239 OQSO for block5.rng using bits 22 to 26 141659 -.849 .1981 OQSO for block5.rng using bits 21 to 25 141851 -.198 .4216 OQSO for block5.rng using bits 20 to 24 142038 .436 .6686 OQSO for block5.rng using bits 19 to 23 142035 .426 .6649 OQSO for block5.rng using bits 18 to 22 141723 -.632 .2638 OQSO for block5.rng using bits 17 to 21 141911 .006 .5023 OQSO for block5.rng using bits 16 to 20 142173 .894 .8143 OQSO for block5.rng using bits 15 to 19 142042 .450 .6735 OQSO for block5.rng using bits 14 to 18 141463 -1.513 .0651 OQSO for block5.rng using bits 13 to 17 141657 -.855 .1962 OQSO for block5.rng using bits 12 to 16 141961 .175 .5695 OQSO for block5.rng using bits 11 to 15 141732 -.601 .2739 OQSO for block5.rng using bits 10 to 14 142475 1.918 .9724 OQSO for block5.rng using bits 9 to 13 142126 .734 .7687 OQSO for block5.rng using bits 8 to 12 141594 -1.069 .1426 OQSO for block5.rng using bits 7 to 11 141861 -.164 .4349 OQSO for block5.rng using bits 6 to 10 141521 -1.316 .0940 OQSO for block5.rng using bits 5 to 9 141727 -.618 .2683 OQSO for block5.rng using bits 4 to 8 141671 -.808 .2096 OQSO for block5.rng using bits 3 to 7 141968 .199 .5788 OQSO for block5.rng using bits 2 to 6 142115 .697 .7572 OQSO for block5.rng using bits 1 to 5 142156 .836 .7985 DNA test for generator block5.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p DNA for block5.rng using bits 31 to 32 142050 .415 .6609 DNA for block5.rng using bits 30 to 31 141928 .055 .5220 DNA for block5.rng using bits 29 to 30 141991 .241 .5952 DNA for block5.rng using bits 28 to 29 141970 .179 .5710 DNA for block5.rng using bits 27 to 28 142266 1.052 .8536 DNA for block5.rng using bits 26 to 27 142099 .560 .7121 DNA for block5.rng using bits 25 to 26 142134 .663 .7463 DNA for block5.rng using bits 24 to 25 141095 -2.402 .0081 DNA for block5.rng using bits 23 to 24 141670 -.706 .2401 DNA for block5.rng using bits 22 to 23 141910 .002 .5008 DNA for block5.rng using bits 21 to 22 141627 -.833 .2025 DNA for block5.rng using bits 20 to 21 142263 1.043 .8516 DNA for block5.rng using bits 19 to 20 142075 .489 .6875 DNA for block5.rng using bits 18 to 19 142109 .589 .7221 DNA for block5.rng using bits 17 to 18 141791 -.349 .3635 DNA for block5.rng using bits 16 to 17 142231 .949 .8287 DNA for block5.rng using bits 15 to 16 141815 -.278 .3904 DNA for block5.rng using bits 14 to 15 142512 1.778 .9623 DNA for block5.rng using bits 13 to 14 141999 .265 .6043 DNA for block5.rng using bits 12 to 13 142209 .884 .8116 DNA for block5.rng using bits 11 to 12 142313 1.191 .8831 DNA for block5.rng using bits 10 to 11 141700 -.617 .2685 DNA for block5.rng using bits 9 to 10 141994 .250 .5986 DNA for block5.rng using bits 8 to 9 142276 1.082 .8603 DNA for block5.rng using bits 7 to 8 141998 .262 .6032 DNA for block5.rng using bits 6 to 7 142673 2.253 .9879 DNA for block5.rng using bits 5 to 6 141662 -.730 .2328 DNA for block5.rng using bits 4 to 5 141565 -1.016 .1549 DNA for block5.rng using bits 3 to 4 142021 .329 .6291 DNA for block5.rng using bits 2 to 3 142102 .568 .7151 DNA for block5.rng using bits 1 to 2 142644 2.167 .9849 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block5.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 block5.rng 2455.34 -.632 .263829 byte stream for block5.rng 2518.12 .256 .601148 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 2428.60 -1.010 .156311 bits 2 to 9 2496.99 -.043 .483023 bits 3 to 10 2600.20 1.417 .921759 bits 4 to 11 2407.92 -1.302 .096415 bits 5 to 12 2553.04 .750 .773386 bits 6 to 13 2421.41 -1.111 .133179 bits 7 to 14 2543.48 .615 .730671 bits 8 to 15 2587.63 1.239 .892382 bits 9 to 16 2577.43 1.095 .863243 bits 10 to 17 2456.08 -.621 .267258 bits 11 to 18 2544.62 .631 .736000 bits 12 to 19 2493.67 -.090 .464307 bits 13 to 20 2590.92 1.286 .900748 bits 14 to 21 2584.69 1.198 .884494 bits 15 to 22 2550.21 .710 .761156 bits 16 to 23 2503.84 .054 .521670 bits 17 to 24 2444.12 -.790 .214680 bits 18 to 25 2382.54 -1.661 .048342 bits 19 to 26 2454.89 -.638 .261760 bits 20 to 27 2492.49 -.106 .457704 bits 21 to 28 2586.25 1.220 .888716 bits 22 to 29 2434.63 -.925 .177607 bits 23 to 30 2557.27 .810 .790996 bits 24 to 31 2433.07 -.947 .171937 bits 25 to 32 2484.27 -.222 .411975 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block5.rng Of 12,000 tries, the average no. of successes should be 3523 with sigma=21.9 Successes: 3535 z-score: .548 p-value: .708135 Successes: 3517 z-score: -.274 p-value: .392053 Successes: 3511 z-score: -.548 p-value: .291865 Successes: 3514 z-score: -.411 p-value: .340551 Successes: 3539 z-score: .731 p-value: .767486 Successes: 3496 z-score: -1.233 p-value: .108811 Successes: 3538 z-score: .685 p-value: .753306 Successes: 3501 z-score: -1.005 p-value: .157553 Successes: 3555 z-score: 1.461 p-value: .928018 Successes: 3540 z-score: .776 p-value: .781201 square size avg. no. parked sample sigma 100. 3524.600 18.408 KSTEST for the above 10: p= .102151 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block5.rng Sample no. d^2 avg equiv uni 5 1.3199 .4512 .734608 10 2.6141 .7362 .927724 15 1.0100 .8543 .637634 20 1.4339 .8458 .763332 25 .9678 .7770 .621937 30 .3322 .9414 .283847 35 .7507 1.0243 .529719 40 .3455 .9960 .293364 45 2.3645 1.0308 .907115 50 .1963 1.0072 .179006 55 .4921 .9980 .390175 60 2.2287 1.0633 .893533 65 .8783 1.0328 .586345 70 .7382 1.0267 .523791 75 .3841 1.0043 .320257 80 .0208 .9695 .020717 85 .4425 .9502 .359021 90 .6310 .9851 .469650 95 .1621 .9486 .150338 100 .2302 .9470 .206559 MINIMUM DISTANCE TEST for block5.rng Result of KS test on 20 transformed mindist^2's: p-value= .503603 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block5.rng sample no: 1 r^3= 29.363 p-value= .62422 sample no: 2 r^3= 5.798 p-value= .17574 sample no: 3 r^3= 6.909 p-value= .20571 sample no: 4 r^3= 26.439 p-value= .58575 sample no: 5 r^3= 104.293 p-value= .96908 sample no: 6 r^3= 5.604 p-value= .17038 sample no: 7 r^3= 13.282 p-value= .35772 sample no: 8 r^3= 11.082 p-value= .30885 sample no: 9 r^3= 25.090 p-value= .56670 sample no: 10 r^3= 5.849 p-value= .17713 sample no: 11 r^3= 4.839 p-value= .14897 sample no: 12 r^3= 174.992 p-value= .99707 sample no: 13 r^3= 56.236 p-value= .84658 sample no: 14 r^3= 63.491 p-value= .87953 sample no: 15 r^3= 34.281 p-value= .68104 sample no: 16 r^3= 2.749 p-value= .08756 sample no: 17 r^3= 146.778 p-value= .99250 sample no: 18 r^3= .062 p-value= .00206 sample no: 19 r^3= 7.795 p-value= .22881 sample no: 20 r^3= 10.852 p-value= .30354 A KS test is applied to those 20 p-values. --------------------------------------------------------- 3DSPHERES test for file block5.rng p-value= .743216 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block5.rng Table of standardized frequency counts ( (obs-exp)/sqrt(exp) )^2 for j taking values <=6,7,8,...,47,>=48: -1.5 -.3 .1 1.4 1.3 -1.7 .0 .2 -.8 -1.5 -.2 1.2 -.4 -.7 -.1 1.2 .2 .6 .2 .0 -1.4 .2 -1.3 .9 1.1 .5 .3 .2 .0 -.4 -.8 .6 -.5 .0 -.5 -2.6 .0 -1.0 .1 1.0 1.6 3.0 -.1 Chi-square with 42 degrees of freedom: 43.969 z-score= .215 p-value= .611928 ______________________________________________________________ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 .634387 Test no. 2 p-value .661018 Test no. 3 p-value .080425 Test no. 4 p-value .708840 Test no. 5 p-value .344657 Test no. 6 p-value .768837 Test no. 7 p-value .396214 Test no. 8 p-value .358390 Test no. 9 p-value .027324 Test no. 10 p-value .760155 Results of the OSUM test for block5.rng KSTEST on the above 10 p-values: .290043 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block5.rng Up and down runs in a sample of 10000 _________________________________________________ Run test for block5.rng : runs up; ks test for 10 p's: .741353 runs down; ks test for 10 p's: .212547 Run test for block5.rng : runs up; ks test for 10 p's: .797036 runs down; ks test for 10 p's: .551932 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block5.rng No. of wins: Observed Expected 98747 98585.86 98747= No. of wins, z-score= .721 pvalue= .76446 Analysis of Throws-per-Game: Chisq= 15.76 for 20 degrees of freedom, p= .26863 Throws Observed Expected Chisq Sum 1 66377 66666.7 1.259 1.259 2 37848 37654.3 .996 2.255 3 27018 26954.7 .149 2.403 4 19237 19313.5 .303 2.706 5 13946 13851.4 .646 3.352 6 9874 9943.5 .486 3.838 7 7168 7145.0 .074 3.912 8 5254 5139.1 2.570 6.482 9 3662 3699.9 .388 6.870 10 2654 2666.3 .057 6.927 11 1918 1923.3 .015 6.941 12 1337 1388.7 1.928 8.869 13 1025 1003.7 .451 9.320 14 715 726.1 .171 9.491 15 568 525.8 3.381 12.872 16 384 381.2 .021 12.894 17 271 276.5 .111 13.004 18 206 200.8 .133 13.138 19 151 146.0 .172 13.310 20 118 106.2 1.308 14.617 21 269 287.1 1.143 15.760 SUMMARY FOR block5.rng p-value for no. of wins: .764458 p-value for throws/game: .268631 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Results of DIEHARD battery of tests sent to file report5.txt