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 block80.rng For a sample of size 500: mean block80.rng using bits 1 to 24 1.976 duplicate number number spacings observed expected 0 65. 67.668 1 127. 135.335 2 150. 135.335 3 93. 90.224 4 47. 45.112 5 15. 18.045 6 to INF 3. 8.282 Chisquare with 6 d.o.f. = 6.25 p-value= .604688 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block80.rng using bits 2 to 25 1.918 duplicate number number spacings observed expected 0 64. 67.668 1 155. 135.335 2 128. 135.335 3 87. 90.224 4 48. 45.112 5 13. 18.045 6 to INF 5. 8.282 Chisquare with 6 d.o.f. = 6.46 p-value= .626798 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block80.rng using bits 3 to 26 1.940 duplicate number number spacings observed expected 0 63. 67.668 1 146. 135.335 2 145. 135.335 3 85. 90.224 4 37. 45.112 5 14. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = 4.88 p-value= .440275 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block80.rng using bits 4 to 27 2.042 duplicate number number spacings observed expected 0 54. 67.668 1 142. 135.335 2 131. 135.335 3 107. 90.224 4 44. 45.112 5 14. 18.045 6 to INF 8. 8.282 Chisquare with 6 d.o.f. = 7.29 p-value= .705209 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block80.rng using bits 5 to 28 2.176 duplicate number number spacings observed expected 0 56. 67.668 1 130. 135.335 2 124. 135.335 3 100. 90.224 4 57. 45.112 5 21. 18.045 6 to INF 12. 8.282 Chisquare with 6 d.o.f. = 9.52 p-value= .853484 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block80.rng using bits 6 to 29 1.930 duplicate number number spacings observed expected 0 69. 67.668 1 147. 135.335 2 129. 135.335 3 89. 90.224 4 47. 45.112 5 12. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 3.65 p-value= .275693 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block80.rng using bits 7 to 30 2.004 duplicate number number spacings observed expected 0 61. 67.668 1 141. 135.335 2 139. 135.335 3 86. 90.224 4 52. 45.112 5 13. 18.045 6 to INF 8. 8.282 Chisquare with 6 d.o.f. = 3.66 p-value= .277796 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block80.rng using bits 8 to 31 2.000 duplicate number number spacings observed expected 0 68. 67.668 1 127. 135.335 2 145. 135.335 3 89. 90.224 4 46. 45.112 5 20. 18.045 6 to INF 5. 8.282 Chisquare with 6 d.o.f. = 2.75 p-value= .160687 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block80.rng using bits 9 to 32 1.948 duplicate number number spacings observed expected 0 62. 67.668 1 153. 135.335 2 133. 135.335 3 90. 90.224 4 37. 45.112 5 17. 18.045 6 to INF 8. 8.282 Chisquare with 6 d.o.f. = 4.35 p-value= .370567 ::::::::::::::::::::::::::::::::::::::::: The 9 p-values were .604688 .626798 .440275 .705209 .853484 .275693 .277796 .160687 .370567 A KSTEST for the 9 p-values yields .235075 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block80.rng For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom= 86.980; p-value= .199352 OPERM5 test for file block80.rng For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=102.669; p-value= .619796 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block80.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 225 211.4 .872538 .873 29 5140 5134.0 .006988 .880 30 23228 23103.0 .675811 1.555 31 11407 11551.5 1.808186 3.364 chisquare= 3.364 for 3 d. of f.; p-value= .694429 -------------------------------------------------------------- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block80.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 218 211.4 .204914 .205 30 5126 5134.0 .012498 .217 31 22989 23103.0 .562986 .780 32 11667 11551.5 1.154359 1.935 chisquare= 1.935 for 3 d. of f.; p-value= .496062 -------------------------------------------------------------- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block80.rng Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 1 to 8 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 952 944.3 .063 .063 r =5 21491 21743.9 2.941 3.004 r =6 77557 77311.8 .778 3.782 p=1-exp(-SUM/2)= .84907 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 2 to 9 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 915 944.3 .909 .909 r =5 21719 21743.9 .029 .938 r =6 77366 77311.8 .038 .976 p=1-exp(-SUM/2)= .38606 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 3 to 10 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 927 944.3 .317 .317 r =5 21877 21743.9 .815 1.132 r =6 77196 77311.8 .173 1.305 p=1-exp(-SUM/2)= .47931 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 4 to 11 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 928 944.3 .281 .281 r =5 21560 21743.9 1.555 1.837 r =6 77512 77311.8 .518 2.355 p=1-exp(-SUM/2)= .69198 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 5 to 12 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 923 944.3 .481 .481 r =5 21718 21743.9 .031 .511 r =6 77359 77311.8 .029 .540 p=1-exp(-SUM/2)= .23669 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 6 to 13 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 925 944.3 .395 .395 r =5 21845 21743.9 .470 .865 r =6 77230 77311.8 .087 .951 p=1-exp(-SUM/2)= .37847 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 7 to 14 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 945 944.3 .001 .001 r =5 22047 21743.9 4.225 4.226 r =6 77008 77311.8 1.194 5.419 p=1-exp(-SUM/2)= .93344 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 8 to 15 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1022 944.3 6.393 6.393 r =5 21718 21743.9 .031 6.424 r =6 77260 77311.8 .035 6.459 p=1-exp(-SUM/2)= .96042 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 9 to 16 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 926 944.3 .355 .355 r =5 21672 21743.9 .238 .592 r =6 77402 77311.8 .105 .698 p=1-exp(-SUM/2)= .29449 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 10 to 17 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 886 944.3 3.600 3.600 r =5 21598 21743.9 .979 4.579 r =6 77516 77311.8 .539 5.118 p=1-exp(-SUM/2)= .92261 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 11 to 18 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 880 944.3 4.379 4.379 r =5 21533 21743.9 2.046 6.424 r =6 77587 77311.8 .980 7.404 p=1-exp(-SUM/2)= .97532 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 12 to 19 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1007 944.3 4.163 4.163 r =5 21893 21743.9 1.022 5.185 r =6 77100 77311.8 .580 5.766 p=1-exp(-SUM/2)= .94402 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 13 to 20 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 965 944.3 .454 .454 r =5 21864 21743.9 .663 1.117 r =6 77171 77311.8 .256 1.374 p=1-exp(-SUM/2)= .49679 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 14 to 21 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1017 944.3 5.597 5.597 r =5 21787 21743.9 .085 5.682 r =6 77196 77311.8 .173 5.856 p=1-exp(-SUM/2)= .94649 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 15 to 22 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 968 944.3 .595 .595 r =5 21735 21743.9 .004 .598 r =6 77297 77311.8 .003 .601 p=1-exp(-SUM/2)= .25964 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 16 to 23 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 943 944.3 .002 .002 r =5 21911 21743.9 1.284 1.286 r =6 77146 77311.8 .356 1.642 p=1-exp(-SUM/2)= .55990 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 17 to 24 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 924 944.3 .436 .436 r =5 21784 21743.9 .074 .510 r =6 77292 77311.8 .005 .515 p=1-exp(-SUM/2)= .22720 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 18 to 25 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 962 944.3 .332 .332 r =5 21764 21743.9 .019 .350 r =6 77274 77311.8 .018 .369 p=1-exp(-SUM/2)= .16839 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 19 to 26 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 932 944.3 .160 .160 r =5 21633 21743.9 .566 .726 r =6 77435 77311.8 .196 .922 p=1-exp(-SUM/2)= .36940 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 20 to 27 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 905 944.3 1.636 1.636 r =5 21584 21743.9 1.176 2.812 r =6 77511 77311.8 .513 3.325 p=1-exp(-SUM/2)= .81032 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 21 to 28 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 959 944.3 .229 .229 r =5 21787 21743.9 .085 .314 r =6 77254 77311.8 .043 .357 p=1-exp(-SUM/2)= .16366 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 22 to 29 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 918 944.3 .733 .733 r =5 21712 21743.9 .047 .779 r =6 77370 77311.8 .044 .823 p=1-exp(-SUM/2)= .33740 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 23 to 30 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 973 944.3 .872 .872 r =5 21509 21743.9 2.538 3.410 r =6 77518 77311.8 .550 3.960 p=1-exp(-SUM/2)= .86192 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 24 to 31 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 903 944.3 1.806 1.806 r =5 21897 21743.9 1.078 2.884 r =6 77200 77311.8 .162 3.046 p=1-exp(-SUM/2)= .78195 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block80.rng b-rank test for bits 25 to 32 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 918 944.3 .733 .733 r =5 21982 21743.9 2.607 3.340 r =6 77100 77311.8 .580 3.920 p=1-exp(-SUM/2)= .85915 TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices These should be 25 uniform [0,1] random variables: .849068 .386059 .479306 .691975 .236685 .378469 .933444 .960418 .294491 .922611 .975322 .944024 .496792 .946489 .259639 .559904 .227202 .168392 .369405 .810317 .163662 .337399 .861915 .781952 .859146 brank test summary for block80.rng The KS test for those 25 supposed UNI's yields KS p-value= .925580 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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: 142299 missing words, .91 sigmas from mean, p-value= .81871 tst no 2: 142127 missing words, .51 sigmas from mean, p-value= .69448 tst no 3: 141446 missing words, -1.08 sigmas from mean, p-value= .13951 tst no 4: 141831 missing words, -.18 sigmas from mean, p-value= .42740 tst no 5: 142370 missing words, 1.08 sigmas from mean, p-value= .85911 tst no 6: 141880 missing words, -.07 sigmas from mean, p-value= .47268 tst no 7: 142132 missing words, .52 sigmas from mean, p-value= .69856 tst no 8: 142500 missing words, 1.38 sigmas from mean, p-value= .91622 tst no 9: 141868 missing words, -.10 sigmas from mean, p-value= .46154 tst no 10: 142094 missing words, .43 sigmas from mean, p-value= .66694 tst no 11: 142239 missing words, .77 sigmas from mean, p-value= .77943 tst no 12: 141846 missing words, -.15 sigmas from mean, p-value= .44119 tst no 13: 141016 missing words, -2.09 sigmas from mean, p-value= .01843 tst no 14: 142401 missing words, 1.15 sigmas from mean, p-value= .87467 tst no 15: 141831 missing words, -.18 sigmas from mean, p-value= .42740 tst no 16: 141822 missing words, -.20 sigmas from mean, p-value= .41916 tst no 17: 142534 missing words, 1.46 sigmas from mean, p-value= .92779 tst no 18: 141772 missing words, -.32 sigmas from mean, p-value= .37416 tst no 19: 141787 missing words, -.29 sigmas from mean, p-value= .38751 tst no 20: 142262 missing words, .82 sigmas from mean, p-value= .79503 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block80.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OPSO for block80.rng using bits 23 to 32 142083 .599 .7254 OPSO for block80.rng using bits 22 to 31 141665 -.843 .1998 OPSO for block80.rng using bits 21 to 30 141844 -.225 .4109 OPSO for block80.rng using bits 20 to 29 142306 1.368 .9143 OPSO for block80.rng using bits 19 to 28 142117 .716 .7630 OPSO for block80.rng using bits 18 to 27 142164 .878 .8101 OPSO for block80.rng using bits 17 to 26 141922 .044 .5174 OPSO for block80.rng using bits 16 to 25 141923 .047 .5188 OPSO for block80.rng using bits 15 to 24 141356 -1.908 .0282 OPSO for block80.rng using bits 14 to 23 142321 1.420 .9221 OPSO for block80.rng using bits 13 to 22 142185 .951 .8291 OPSO for block80.rng using bits 12 to 21 141667 -.836 .2017 OPSO for block80.rng using bits 11 to 20 141853 -.194 .4230 OPSO for block80.rng using bits 10 to 19 142088 .616 .7311 OPSO for block80.rng using bits 9 to 18 142133 .771 .7797 OPSO for block80.rng using bits 8 to 17 141799 -.380 .3518 OPSO for block80.rng using bits 7 to 16 142209 1.033 .8493 OPSO for block80.rng using bits 6 to 15 142220 1.071 .8580 OPSO for block80.rng using bits 5 to 14 141713 -.677 .2492 OPSO for block80.rng using bits 4 to 13 141736 -.598 .2750 OPSO for block80.rng using bits 3 to 12 142091 .626 .7345 OPSO for block80.rng using bits 2 to 11 141619 -1.001 .1584 OPSO for block80.rng using bits 1 to 10 141727 -.629 .2648 OQSO test for generator block80.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OQSO for block80.rng using bits 28 to 32 141462 -1.516 .0647 OQSO for block80.rng using bits 27 to 31 142074 .558 .7116 OQSO for block80.rng using bits 26 to 30 142641 2.480 .9934 OQSO for block80.rng using bits 25 to 29 142181 .921 .8215 OQSO for block80.rng using bits 24 to 28 142217 1.043 .8515 OQSO for block80.rng using bits 23 to 27 141811 -.333 .3694 OQSO for block80.rng using bits 22 to 26 141869 -.137 .4456 OQSO for block80.rng using bits 21 to 25 142194 .965 .8327 OQSO for block80.rng using bits 20 to 24 142140 .782 .7829 OQSO for block80.rng using bits 19 to 23 142072 .551 .7093 OQSO for block80.rng using bits 18 to 22 142071 .548 .7082 OQSO for block80.rng using bits 17 to 21 141802 -.364 .3580 OQSO for block80.rng using bits 16 to 20 141976 .226 .5894 OQSO for block80.rng using bits 15 to 19 142190 .951 .8293 OQSO for block80.rng using bits 14 to 18 141739 -.577 .2818 OQSO for block80.rng using bits 13 to 17 142196 .972 .8344 OQSO for block80.rng using bits 12 to 16 142049 .473 .6821 OQSO for block80.rng using bits 11 to 15 141987 .263 .6038 OQSO for block80.rng using bits 10 to 14 142472 1.907 .9718 OQSO for block80.rng using bits 9 to 13 142211 1.023 .8468 OQSO for block80.rng using bits 8 to 12 142184 .931 .8241 OQSO for block80.rng using bits 7 to 11 141850 -.201 .4203 OQSO for block80.rng using bits 6 to 10 141997 .297 .6168 OQSO for block80.rng using bits 5 to 9 141586 -1.096 .1365 OQSO for block80.rng using bits 4 to 8 142141 .785 .7839 OQSO for block80.rng using bits 3 to 7 142211 1.023 .8468 OQSO for block80.rng using bits 2 to 6 141864 -.154 .4389 OQSO for block80.rng using bits 1 to 5 141976 .226 .5894 DNA test for generator block80.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p DNA for block80.rng using bits 31 to 32 141472 -1.290 .0985 DNA for block80.rng using bits 30 to 31 141926 .049 .5196 DNA for block80.rng using bits 29 to 30 141444 -1.373 .0849 DNA for block80.rng using bits 28 to 29 141534 -1.107 .1341 DNA for block80.rng using bits 27 to 28 141665 -.721 .2355 DNA for block80.rng using bits 26 to 27 141746 -.482 .3150 DNA for block80.rng using bits 25 to 26 141975 .194 .5768 DNA for block80.rng using bits 24 to 25 142220 .916 .8203 DNA for block80.rng using bits 23 to 24 141523 -1.140 .1272 DNA for block80.rng using bits 22 to 23 141833 -.225 .4109 DNA for block80.rng using bits 21 to 22 141720 -.558 .2883 DNA for block80.rng using bits 20 to 21 141717 -.567 .2852 DNA for block80.rng using bits 19 to 20 141579 -.974 .1649 DNA for block80.rng using bits 18 to 19 141854 -.163 .4352 DNA for block80.rng using bits 17 to 18 140947 -2.839 .0023 DNA for block80.rng using bits 16 to 17 141686 -.659 .2550 DNA for block80.rng using bits 15 to 16 141887 -.066 .4737 DNA for block80.rng using bits 14 to 15 141835 -.219 .4132 DNA for block80.rng using bits 13 to 14 141669 -.709 .2392 DNA for block80.rng using bits 12 to 13 142244 .987 .8382 DNA for block80.rng using bits 11 to 12 142293 1.132 .8711 DNA for block80.rng using bits 10 to 11 142123 .630 .7358 DNA for block80.rng using bits 9 to 10 142168 .763 .7773 DNA for block80.rng using bits 8 to 9 141684 -.665 .2531 DNA for block80.rng using bits 7 to 8 141662 -.730 .2328 DNA for block80.rng using bits 6 to 7 141542 -1.084 .1393 DNA for block80.rng using bits 5 to 6 141666 -.718 .2364 DNA for block80.rng using bits 4 to 5 141642 -.789 .2152 DNA for block80.rng using bits 3 to 4 141220 -2.033 .0210 DNA for block80.rng using bits 2 to 3 141726 -.541 .2943 DNA for block80.rng using bits 1 to 2 142790 2.598 .9953 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block80.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 block80.rng 2494.34 -.080 .468083 byte stream for block80.rng 2485.99 -.198 .421453 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 2427.80 -1.021 .153618 bits 2 to 9 2421.91 -1.104 .134730 bits 3 to 10 2431.09 -.974 .164913 bits 4 to 11 2425.45 -1.054 .145889 bits 5 to 12 2507.20 .102 .540570 bits 6 to 13 2475.18 -.351 .362776 bits 7 to 14 2549.35 .698 .757381 bits 8 to 15 2405.10 -1.342 .089781 bits 9 to 16 2594.14 1.331 .908455 bits 10 to 17 2429.05 -1.003 .157835 bits 11 to 18 2489.03 -.155 .438361 bits 12 to 19 2505.11 .072 .528784 bits 13 to 20 2531.46 .445 .671828 bits 14 to 21 2331.95 -2.377 .008736 bits 15 to 22 2541.81 .591 .722840 bits 16 to 23 2570.83 1.002 .841759 bits 17 to 24 2588.69 1.254 .895130 bits 18 to 25 2439.76 -.852 .197146 bits 19 to 26 2419.06 -1.145 .126177 bits 20 to 27 2619.23 1.686 .954114 bits 21 to 28 2583.61 1.182 .881471 bits 22 to 29 2494.97 -.071 .471670 bits 23 to 30 2560.83 .860 .805181 bits 24 to 31 2555.04 .778 .781831 bits 25 to 32 2546.71 .661 .745579 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block80.rng Of 12,000 tries, the average no. of successes should be 3523 with sigma=21.9 Successes: 3544 z-score: .959 p-value: .831196 Successes: 3571 z-score: 2.192 p-value: .985802 Successes: 3507 z-score: -.731 p-value: .232514 Successes: 3569 z-score: 2.100 p-value: .982156 Successes: 3522 z-score: -.046 p-value: .481790 Successes: 3520 z-score: -.137 p-value: .445521 Successes: 3509 z-score: -.639 p-value: .261324 Successes: 3555 z-score: 1.461 p-value: .928018 Successes: 3487 z-score: -1.644 p-value: .050105 Successes: 3499 z-score: -1.096 p-value: .136563 square size avg. no. parked sample sigma 100. 3528.300 28.155 KSTEST for the above 10: p= .681827 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block80.rng Sample no. d^2 avg equiv uni 5 2.3393 1.2062 .904734 10 1.1580 1.4769 .687696 15 .7670 1.3437 .537405 20 .3312 1.1539 .283120 25 .0697 1.1937 .067638 30 .7342 1.2441 .521885 35 4.7750 1.3076 .991762 40 .7993 1.2078 .552152 45 .6832 1.1718 .496747 50 .4924 1.1378 .390373 55 .9650 1.1561 .620878 60 .9953 1.1508 .632223 65 1.9020 1.1368 .852155 70 .1926 1.1195 .176004 75 .7094 1.0947 .509794 80 1.9785 1.0819 .863088 85 .5629 1.0790 .432076 90 1.2866 1.0530 .725571 95 2.9612 1.0718 .949008 100 1.3555 1.0448 .743922 MINIMUM DISTANCE TEST for block80.rng Result of KS test on 20 transformed mindist^2's: p-value= .633566 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block80.rng sample no: 1 r^3= 24.438 p-value= .55718 sample no: 2 r^3= 16.018 p-value= .41370 sample no: 3 r^3= 98.386 p-value= .96235 sample no: 4 r^3= 26.389 p-value= .58506 sample no: 5 r^3= 27.677 p-value= .60250 sample no: 6 r^3= 22.900 p-value= .53389 sample no: 7 r^3= 48.193 p-value= .79940 sample no: 8 r^3= 107.780 p-value= .97248 sample no: 9 r^3= 37.592 p-value= .71437 sample no: 10 r^3= 36.823 p-value= .70696 sample no: 11 r^3= 13.982 p-value= .37252 sample no: 12 r^3= 3.250 p-value= .10267 sample no: 13 r^3= 23.088 p-value= .53680 sample no: 14 r^3= 55.037 p-value= .84032 sample no: 15 r^3= 19.135 p-value= .47156 sample no: 16 r^3= 30.124 p-value= .63364 sample no: 17 r^3= 20.095 p-value= .48821 sample no: 18 r^3= .347 p-value= .01150 sample no: 19 r^3= 5.733 p-value= .17394 sample no: 20 r^3= 57.827 p-value= .85450 A KS test is applied to those 20 p-values. --------------------------------------------------------- 3DSPHERES test for file block80.rng p-value= .610743 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block80.rng Table of standardized frequency counts ( (obs-exp)/sqrt(exp) )^2 for j taking values <=6,7,8,...,47,>=48: -.1 -1.2 .3 .6 1.1 .9 -1.1 .7 1.9 1.5 -.6 1.7 -.3 -.7 -1.2 1.4 -.9 -1.1 -.2 -.9 -.9 .2 .8 .7 .8 .3 1.4 .2 .4 -1.8 -.4 -.5 .0 -1.1 -1.0 -1.2 -.2 .5 -.8 -1.3 .1 .0 -.1 Chi-square with 42 degrees of freedom: 35.853 z-score= -.671 p-value= .263167 ______________________________________________________________ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 .606530 Test no. 2 p-value .722874 Test no. 3 p-value .759824 Test no. 4 p-value .470440 Test no. 5 p-value .994031 Test no. 6 p-value .859879 Test no. 7 p-value .231704 Test no. 8 p-value .472766 Test no. 9 p-value .948360 Test no. 10 p-value .194429 Results of the OSUM test for block80.rng KSTEST on the above 10 p-values: .733958 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block80.rng Up and down runs in a sample of 10000 _________________________________________________ Run test for block80.rng : runs up; ks test for 10 p's: .446608 runs down; ks test for 10 p's: .086867 Run test for block80.rng : runs up; ks test for 10 p's: .334901 runs down; ks test for 10 p's: .912726 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block80.rng No. of wins: Observed Expected 98907 98585.86 98907= No. of wins, z-score= 1.436 pvalue= .92455 Analysis of Throws-per-Game: Chisq= 25.72 for 20 degrees of freedom, p= .82476 Throws Observed Expected Chisq Sum 1 66779 66666.7 .189 .189 2 37609 37654.3 .055 .244 3 26848 26954.7 .423 .666 4 19625 19313.5 5.025 5.692 5 13955 13851.4 .775 6.466 6 9806 9943.5 1.903 8.369 7 7135 7145.0 .014 8.383 8 5010 5139.1 3.242 11.625 9 3655 3699.9 .544 12.169 10 2609 2666.3 1.231 13.400 11 1968 1923.3 1.038 14.437 12 1283 1388.7 8.051 22.489 13 1030 1003.7 .688 23.177 14 733 726.1 .065 23.242 15 552 525.8 1.302 24.544 16 385 381.2 .039 24.583 17 280 276.5 .043 24.626 18 208 200.8 .256 24.882 19 151 146.0 .172 25.054 20 99 106.2 .490 25.544 21 280 287.1 .176 25.721 SUMMARY FOR block80.rng p-value for no. of wins: .924546 p-value for throws/game: .824762 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Results of DIEHARD battery of tests sent to file report80.txt