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 block2.rng For a sample of size 500: mean block2.rng using bits 1 to 24 1.962 duplicate number number spacings observed expected 0 83. 67.668 1 119. 135.335 2 122. 135.335 3 110. 90.224 4 45. 45.112 5 18. 18.045 6 to INF 3. 8.282 Chisquare with 6 d.o.f. = 14.46 p-value= .975134 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block2.rng using bits 2 to 25 2.002 duplicate number number spacings observed expected 0 62. 67.668 1 137. 135.335 2 140. 135.335 3 90. 90.224 4 49. 45.112 5 15. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 1.70 p-value= .055171 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block2.rng using bits 3 to 26 1.848 duplicate number number spacings observed expected 0 66. 67.668 1 172. 135.335 2 121. 135.335 3 90. 90.224 4 26. 45.112 5 17. 18.045 6 to INF 8. 8.282 Chisquare with 6 d.o.f. = 19.66 p-value= .996817 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block2.rng using bits 4 to 27 1.980 duplicate number number spacings observed expected 0 64. 67.668 1 140. 135.335 2 152. 135.335 3 69. 90.224 4 44. 45.112 5 24. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 9.60 p-value= .857237 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block2.rng using bits 5 to 28 1.930 duplicate number number spacings observed expected 0 79. 67.668 1 139. 135.335 2 125. 135.335 3 83. 90.224 4 50. 45.112 5 18. 18.045 6 to INF 6. 8.282 Chisquare with 6 d.o.f. = 4.52 p-value= .393750 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block2.rng using bits 6 to 29 1.980 duplicate number number spacings observed expected 0 73. 67.668 1 131. 135.335 2 136. 135.335 3 90. 90.224 4 40. 45.112 5 23. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 2.70 p-value= .154706 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block2.rng using bits 7 to 30 1.994 duplicate number number spacings observed expected 0 69. 67.668 1 140. 135.335 2 123. 135.335 3 97. 90.224 4 45. 45.112 5 16. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = 2.41 p-value= .121461 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block2.rng using bits 8 to 31 1.932 duplicate number number spacings observed expected 0 68. 67.668 1 148. 135.335 2 131. 135.335 3 85. 90.224 4 48. 45.112 5 14. 18.045 6 to INF 6. 8.282 Chisquare with 6 d.o.f. = 3.35 p-value= .235971 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block2.rng using bits 9 to 32 2.070 duplicate number number spacings observed expected 0 54. 67.668 1 126. 135.335 2 146. 135.335 3 109. 90.224 4 43. 45.112 5 16. 18.045 6 to INF 6. 8.282 Chisquare with 6 d.o.f. = 9.11 p-value= .832611 ::::::::::::::::::::::::::::::::::::::::: The 9 p-values were .975134 .055171 .996817 .857237 .393750 .154706 .121461 .235971 .832611 A KSTEST for the 9 p-values yields .782829 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block2.rng For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=107.290; p-value= .732627 OPERM5 test for file block2.rng For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom= 98.253; p-value= .497661 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block2.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 209 211.4 .027655 .028 29 5139 5134.0 .004850 .033 30 23230 23103.0 .697618 .730 31 11422 11551.5 1.452326 2.182 chisquare= 2.182 for 3 d. of f.; p-value= .534383 -------------------------------------------------------------- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block2.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 206 211.4 .138848 .139 30 4984 5134.0 4.383138 4.522 31 23211 23103.0 .504430 5.026 32 11599 11551.5 .195120 5.222 chisquare= 5.222 for 3 d. of f.; p-value= .854879 -------------------------------------------------------------- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block2.rng Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 1 to 8 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 967 944.3 .546 .546 r =5 21627 21743.9 .628 1.174 r =6 77406 77311.8 .115 1.289 p=1-exp(-SUM/2)= .47504 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 2 to 9 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 972 944.3 .812 .812 r =5 21723 21743.9 .020 .833 r =6 77305 77311.8 .001 .833 p=1-exp(-SUM/2)= .34070 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 3 to 10 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 949 944.3 .023 .023 r =5 21883 21743.9 .890 .913 r =6 77168 77311.8 .267 1.181 p=1-exp(-SUM/2)= .44587 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 4 to 11 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 962 944.3 .332 .332 r =5 21636 21743.9 .535 .867 r =6 77402 77311.8 .105 .972 p=1-exp(-SUM/2)= .38504 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 5 to 12 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 965 944.3 .454 .454 r =5 21704 21743.9 .073 .527 r =6 77331 77311.8 .005 .532 p=1-exp(-SUM/2)= .23344 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 6 to 13 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 921 944.3 .575 .575 r =5 22059 21743.9 4.566 5.141 r =6 77020 77311.8 1.101 6.243 p=1-exp(-SUM/2)= .95590 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 7 to 14 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 995 944.3 2.722 2.722 r =5 21779 21743.9 .057 2.779 r =6 77226 77311.8 .095 2.874 p=1-exp(-SUM/2)= .76234 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 8 to 15 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 949 944.3 .023 .023 r =5 21865 21743.9 .674 .698 r =6 77186 77311.8 .205 .903 p=1-exp(-SUM/2)= .36318 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 9 to 16 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 943 944.3 .002 .002 r =5 21766 21743.9 .022 .024 r =6 77291 77311.8 .006 .030 p=1-exp(-SUM/2)= .01482 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 10 to 17 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 942 944.3 .006 .006 r =5 21734 21743.9 .005 .010 r =6 77324 77311.8 .002 .012 p=1-exp(-SUM/2)= .00600 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 11 to 18 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 966 944.3 .499 .499 r =5 21637 21743.9 .526 1.024 r =6 77397 77311.8 .094 1.118 p=1-exp(-SUM/2)= .42823 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 12 to 19 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 919 944.3 .678 .678 r =5 21884 21743.9 .903 1.581 r =6 77197 77311.8 .170 1.751 p=1-exp(-SUM/2)= .58336 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 13 to 20 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 931 944.3 .187 .187 r =5 21680 21743.9 .188 .375 r =6 77389 77311.8 .077 .452 p=1-exp(-SUM/2)= .20237 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 14 to 21 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 999 944.3 3.168 3.168 r =5 21913 21743.9 1.315 4.483 r =6 77088 77311.8 .648 5.131 p=1-exp(-SUM/2)= .92313 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 15 to 22 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 974 944.3 .934 .934 r =5 21909 21743.9 1.254 2.188 r =6 77117 77311.8 .491 2.678 p=1-exp(-SUM/2)= .73796 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 16 to 23 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 979 944.3 1.275 1.275 r =5 21730 21743.9 .009 1.284 r =6 77291 77311.8 .006 1.290 p=1-exp(-SUM/2)= .47521 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.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 21869 21743.9 .720 .731 r =6 77190 77311.8 .192 .923 p=1-exp(-SUM/2)= .36972 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 18 to 25 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 934 944.3 .112 .112 r =5 21797 21743.9 .130 .242 r =6 77269 77311.8 .024 .266 p=1-exp(-SUM/2)= .12442 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 19 to 26 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1004 944.3 3.774 3.774 r =5 21852 21743.9 .537 4.312 r =6 77144 77311.8 .364 4.676 p=1-exp(-SUM/2)= .90347 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 20 to 27 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 904 944.3 1.720 1.720 r =5 21822 21743.9 .281 2.001 r =6 77274 77311.8 .018 2.019 p=1-exp(-SUM/2)= .63560 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 21 to 28 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 919 944.3 .678 .678 r =5 21652 21743.9 .388 1.066 r =6 77429 77311.8 .178 1.244 p=1-exp(-SUM/2)= .46313 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 22 to 29 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 944 944.3 .000 .000 r =5 21661 21743.9 .316 .316 r =6 77395 77311.8 .090 .406 p=1-exp(-SUM/2)= .18359 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 23 to 30 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 983 944.3 1.586 1.586 r =5 21732 21743.9 .007 1.592 r =6 77285 77311.8 .009 1.602 p=1-exp(-SUM/2)= .55106 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 24 to 31 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 947 944.3 .008 .008 r =5 21491 21743.9 2.941 2.949 r =6 77562 77311.8 .810 3.759 p=1-exp(-SUM/2)= .84732 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block2.rng b-rank test for bits 25 to 32 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 925 944.3 .395 .395 r =5 21771 21743.9 .034 .428 r =6 77304 77311.8 .001 .429 p=1-exp(-SUM/2)= .19309 TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices These should be 25 uniform [0,1] random variables: .475042 .340703 .445870 .385036 .233443 .955900 .762344 .363182 .014816 .006002 .428233 .583363 .202373 .923134 .737955 .475207 .369720 .124424 .903469 .635598 .463126 .183594 .551060 .847322 .193086 brank test summary for block2.rng The KS test for those 25 supposed UNI's yields KS p-value= .308795 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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: 142089 missing words, .42 sigmas from mean, p-value= .66268 tst no 2: 141658 missing words, -.59 sigmas from mean, p-value= .27853 tst no 3: 141207 missing words, -1.64 sigmas from mean, p-value= .05040 tst no 4: 141804 missing words, -.25 sigmas from mean, p-value= .40280 tst no 5: 141515 missing words, -.92 sigmas from mean, p-value= .17844 tst no 6: 142354 missing words, 1.04 sigmas from mean, p-value= .85059 tst no 7: 141985 missing words, .18 sigmas from mean, p-value= .57017 tst no 8: 142084 missing words, .41 sigmas from mean, p-value= .65840 tst no 9: 142174 missing words, .62 sigmas from mean, p-value= .73184 tst no 10: 141404 missing words, -1.18 sigmas from mean, p-value= .11887 tst no 11: 142315 missing words, .95 sigmas from mean, p-value= .82839 tst no 12: 141954 missing words, .10 sigmas from mean, p-value= .54156 tst no 13: 142301 missing words, .92 sigmas from mean, p-value= .81994 tst no 14: 141976 missing words, .16 sigmas from mean, p-value= .56189 tst no 15: 141667 missing words, -.57 sigmas from mean, p-value= .28563 tst no 16: 141557 missing words, -.82 sigmas from mean, p-value= .20520 tst no 17: 141884 missing words, -.06 sigmas from mean, p-value= .47641 tst no 18: 141038 missing words, -2.04 sigmas from mean, p-value= .02088 tst no 19: 141555 missing words, -.83 sigmas from mean, p-value= .20387 tst no 20: 142210 missing words, .70 sigmas from mean, p-value= .75882 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block2.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OPSO for block2.rng using bits 23 to 32 141926 .057 .5229 OPSO for block2.rng using bits 22 to 31 141655 -.877 .1902 OPSO for block2.rng using bits 21 to 30 141540 -1.274 .1014 OPSO for block2.rng using bits 20 to 29 141766 -.494 .3106 OPSO for block2.rng using bits 19 to 28 141791 -.408 .3416 OPSO for block2.rng using bits 18 to 27 141599 -1.070 .1423 OPSO for block2.rng using bits 17 to 26 141693 -.746 .2278 OPSO for block2.rng using bits 16 to 25 142020 .382 .6486 OPSO for block2.rng using bits 15 to 24 141910 .002 .5009 OPSO for block2.rng using bits 14 to 23 142107 .682 .7523 OPSO for block2.rng using bits 13 to 22 141345 -1.946 .0258 OPSO for block2.rng using bits 12 to 21 141982 .251 .5989 OPSO for block2.rng using bits 11 to 20 142194 .982 .8369 OPSO for block2.rng using bits 10 to 19 141871 -.132 .4474 OPSO for block2.rng using bits 9 to 18 142285 1.295 .9024 OPSO for block2.rng using bits 8 to 17 142064 .533 .7031 OPSO for block2.rng using bits 7 to 16 142174 .913 .8193 OPSO for block2.rng using bits 6 to 15 141620 -.998 .1592 OPSO for block2.rng using bits 5 to 14 142040 .451 .6739 OPSO for block2.rng using bits 4 to 13 141643 -.918 .1792 OPSO for block2.rng using bits 3 to 12 141938 .099 .5394 OPSO for block2.rng using bits 2 to 11 142019 .378 .6474 OPSO for block2.rng using bits 1 to 10 142118 .720 .7641 OQSO test for generator block2.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OQSO for block2.rng using bits 28 to 32 141417 -1.669 .0476 OQSO for block2.rng using bits 27 to 31 142525 2.087 .9816 OQSO for block2.rng using bits 26 to 30 141540 -1.252 .1053 OQSO for block2.rng using bits 25 to 29 142191 .955 .8302 OQSO for block2.rng using bits 24 to 28 141787 -.415 .3392 OQSO for block2.rng using bits 23 to 27 142081 .582 .7197 OQSO for block2.rng using bits 22 to 26 141832 -.262 .3966 OQSO for block2.rng using bits 21 to 25 141808 -.343 .3656 OQSO for block2.rng using bits 20 to 24 142083 .589 .7220 OQSO for block2.rng using bits 19 to 23 141832 -.262 .3966 OQSO for block2.rng using bits 18 to 22 142059 .507 .6940 OQSO for block2.rng using bits 17 to 21 141768 -.479 .3159 OQSO for block2.rng using bits 16 to 20 141728 -.615 .2694 OQSO for block2.rng using bits 15 to 19 141843 -.225 .4111 OQSO for block2.rng using bits 14 to 18 141865 -.150 .4403 OQSO for block2.rng using bits 13 to 17 142128 .741 .7707 OQSO for block2.rng using bits 12 to 16 142486 1.955 .9747 OQSO for block2.rng using bits 11 to 15 142250 1.155 .8759 OQSO for block2.rng using bits 10 to 14 141631 -.943 .1727 OQSO for block2.rng using bits 9 to 13 142457 1.857 .9683 OQSO for block2.rng using bits 8 to 12 142031 .412 .6600 OQSO for block2.rng using bits 7 to 11 141823 -.293 .3849 OQSO for block2.rng using bits 6 to 10 142458 1.860 .9686 OQSO for block2.rng using bits 5 to 9 141521 -1.316 .0940 OQSO for block2.rng using bits 4 to 8 141551 -1.215 .1122 OQSO for block2.rng using bits 3 to 7 141940 .104 .5414 OQSO for block2.rng using bits 2 to 6 141965 .189 .5748 OQSO for block2.rng using bits 1 to 5 141535 -1.269 .1022 DNA test for generator block2.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p DNA for block2.rng using bits 31 to 32 141866 -.128 .4491 DNA for block2.rng using bits 30 to 31 142219 .913 .8195 DNA for block2.rng using bits 29 to 30 141918 .026 .5102 DNA for block2.rng using bits 28 to 29 142359 1.326 .9077 DNA for block2.rng using bits 27 to 28 141892 -.051 .4796 DNA for block2.rng using bits 26 to 27 142418 1.501 .9333 DNA for block2.rng using bits 25 to 26 142116 .610 .7290 DNA for block2.rng using bits 24 to 25 141643 -.786 .2160 DNA for block2.rng using bits 23 to 24 141628 -.830 .2033 DNA for block2.rng using bits 22 to 23 141877 -.095 .4620 DNA for block2.rng using bits 21 to 22 141905 -.013 .4949 DNA for block2.rng using bits 20 to 21 142216 .905 .8172 DNA for block2.rng using bits 19 to 20 141803 -.314 .3769 DNA for block2.rng using bits 18 to 19 141599 -.915 .1800 DNA for block2.rng using bits 17 to 18 141462 -1.320 .0935 DNA for block2.rng using bits 16 to 17 142067 .465 .6791 DNA for block2.rng using bits 15 to 16 142715 2.377 .9913 DNA for block2.rng using bits 14 to 15 142352 1.306 .9042 DNA for block2.rng using bits 13 to 14 142220 .916 .8203 DNA for block2.rng using bits 12 to 13 141977 .200 .5791 DNA for block2.rng using bits 11 to 12 142416 1.495 .9325 DNA for block2.rng using bits 10 to 11 142532 1.837 .9669 DNA for block2.rng using bits 9 to 10 141785 -.367 .3569 DNA for block2.rng using bits 8 to 9 142192 .834 .7978 DNA for block2.rng using bits 7 to 8 141734 -.517 .3025 DNA for block2.rng using bits 6 to 7 141865 -.131 .4480 DNA for block2.rng using bits 5 to 6 141496 -1.219 .1114 DNA for block2.rng using bits 4 to 5 142407 1.468 .9290 DNA for block2.rng using bits 3 to 4 141585 -.957 .1694 DNA for block2.rng using bits 2 to 3 142239 .972 .8346 DNA for block2.rng using bits 1 to 2 142094 .545 .7070 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block2.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 block2.rng 2541.92 .593 .723350 byte stream for block2.rng 2464.41 -.503 .307360 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 2506.72 .095 .537841 bits 2 to 9 2521.51 .304 .619530 bits 3 to 10 2565.24 .923 .821889 bits 4 to 11 2513.45 .190 .575437 bits 5 to 12 2604.65 1.480 .930567 bits 6 to 13 2495.09 -.069 .472321 bits 7 to 14 2468.40 -.447 .327491 bits 8 to 15 2497.45 -.036 .485615 bits 9 to 16 2495.38 -.065 .473977 bits 10 to 17 2606.28 1.503 .933579 bits 11 to 18 2539.53 .559 .711939 bits 12 to 19 2449.31 -.717 .236707 bits 13 to 20 2469.84 -.427 .334864 bits 14 to 21 2456.07 -.621 .267209 bits 15 to 22 2415.45 -1.196 .115904 bits 16 to 23 2433.21 -.945 .172431 bits 17 to 24 2422.24 -1.100 .135726 bits 18 to 25 2506.90 .098 .538885 bits 19 to 26 2421.74 -1.107 .134193 bits 20 to 27 2514.15 .200 .579280 bits 21 to 28 2471.12 -.408 .341483 bits 22 to 29 2506.29 .089 .535446 bits 23 to 30 2516.45 .233 .591973 bits 24 to 31 2577.72 1.099 .864157 bits 25 to 32 2422.23 -1.100 .135690 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block2.rng Of 12,000 tries, the average no. of successes should be 3523 with sigma=21.9 Successes: 3551 z-score: 1.279 p-value: .899470 Successes: 3513 z-score: -.457 p-value: .323972 Successes: 3519 z-score: -.183 p-value: .427537 Successes: 3504 z-score: -.868 p-value: .192812 Successes: 3580 z-score: 2.603 p-value: .995376 Successes: 3518 z-score: -.228 p-value: .409702 Successes: 3542 z-score: .868 p-value: .807188 Successes: 3549 z-score: 1.187 p-value: .882429 Successes: 3568 z-score: 2.055 p-value: .980051 Successes: 3509 z-score: -.639 p-value: .261324 square size avg. no. parked sample sigma 100. 3535.300 25.066 KSTEST for the above 10: p= .876667 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block2.rng Sample no. d^2 avg equiv uni 5 .3650 .4842 .307079 10 1.1963 .7874 .699504 15 2.3154 1.0809 .902413 20 1.0490 1.0153 .651555 25 1.8590 1.0995 .845628 30 4.3542 1.1730 .987425 35 1.0572 1.1370 .654400 40 .4340 1.1454 .353528 45 .1654 1.1251 .153181 50 2.1226 1.2228 .881545 55 .5501 1.2954 .424682 60 .7003 1.2717 .505286 65 .4166 1.2288 .342112 70 .8006 1.3118 .552747 75 .3872 1.2541 .322394 80 .6747 1.2308 .492421 85 .5588 1.1974 .429705 90 .0874 1.1699 .084066 95 .4232 1.1198 .346417 100 2.1494 1.1011 .884697 MINIMUM DISTANCE TEST for block2.rng Result of KS test on 20 transformed mindist^2's: p-value= .516688 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block2.rng sample no: 1 r^3= 212.550 p-value= .99916 sample no: 2 r^3= 31.020 p-value= .64442 sample no: 3 r^3= 24.176 p-value= .55330 sample no: 4 r^3= 15.143 p-value= .39635 sample no: 5 r^3= .072 p-value= .00238 sample no: 6 r^3= 59.281 p-value= .86138 sample no: 7 r^3= 20.472 p-value= .49460 sample no: 8 r^3= 42.123 p-value= .75441 sample no: 9 r^3= 14.192 p-value= .37690 sample no: 10 r^3= .534 p-value= .01765 sample no: 11 r^3= 15.351 p-value= .40052 sample no: 12 r^3= 25.875 p-value= .57790 sample no: 13 r^3= 1.325 p-value= .04320 sample no: 14 r^3= 14.000 p-value= .37292 sample no: 15 r^3= 81.065 p-value= .93294 sample no: 16 r^3= 27.442 p-value= .59937 sample no: 17 r^3= 61.888 p-value= .87292 sample no: 18 r^3= 23.766 p-value= .54715 sample no: 19 r^3= 14.383 p-value= .38087 sample no: 20 r^3= 13.988 p-value= .37266 A KS test is applied to those 20 p-values. --------------------------------------------------------- 3DSPHERES test for file block2.rng p-value= .578757 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block2.rng Table of standardized frequency counts ( (obs-exp)/sqrt(exp) )^2 for j taking values <=6,7,8,...,47,>=48: -.8 -.3 1.1 .5 -.1 .3 -1.6 .2 1.2 .8 .3 -1.3 1.0 .0 -.7 .0 .5 .3 -.2 .7 .3 -.5 .3 .2 .0 -1.2 -1.5 .9 -1.3 -.3 -1.6 .8 1.8 -2.3 -.5 .4 -.7 -1.0 3.0 -1.8 1.6 -1.0 -.1 Chi-square with 42 degrees of freedom: 47.267 z-score= .575 p-value= .733980 ______________________________________________________________ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 .784409 Test no. 2 p-value .397363 Test no. 3 p-value .716635 Test no. 4 p-value .911424 Test no. 5 p-value .858380 Test no. 6 p-value .840614 Test no. 7 p-value .700915 Test no. 8 p-value .261768 Test no. 9 p-value .683462 Test no. 10 p-value .108448 Results of the OSUM test for block2.rng KSTEST on the above 10 p-values: .775137 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block2.rng Up and down runs in a sample of 10000 _________________________________________________ Run test for block2.rng : runs up; ks test for 10 p's: .430820 runs down; ks test for 10 p's: .632125 Run test for block2.rng : runs up; ks test for 10 p's: .684980 runs down; ks test for 10 p's: .443339 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block2.rng No. of wins: Observed Expected 98409 98585.86 98409= No. of wins, z-score= -.791 pvalue= .21447 Analysis of Throws-per-Game: Chisq= 15.60 for 20 degrees of freedom, p= .25885 Throws Observed Expected Chisq Sum 1 66322 66666.7 1.782 1.782 2 37778 37654.3 .406 2.188 3 27082 26954.7 .601 2.789 4 19315 19313.5 .000 2.789 5 14051 13851.4 2.876 5.665 6 9854 9943.5 .806 6.471 7 7135 7145.0 .014 6.485 8 5058 5139.1 1.279 7.764 9 3663 3699.9 .367 8.132 10 2745 2666.3 2.323 10.455 11 1912 1923.3 .067 10.521 12 1429 1388.7 1.167 11.689 13 1010 1003.7 .039 11.728 14 704 726.1 .675 12.403 15 508 525.8 .605 13.008 16 399 381.2 .836 13.844 17 286 276.5 .324 14.168 18 193 200.8 .305 14.473 19 158 146.0 .989 15.462 20 110 106.2 .135 15.597 21 288 287.1 .003 15.599 SUMMARY FOR block2.rng p-value for no. of wins: .214467 p-value for throws/game: .258854 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Results of DIEHARD battery of tests sent to file report2.txt