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 block3.rng For a sample of size 500: mean block3.rng using bits 1 to 24 2.042 duplicate number number spacings observed expected 0 61. 67.668 1 141. 135.335 2 132. 135.335 3 96. 90.224 4 37. 45.112 5 21. 18.045 6 to INF 12. 8.282 Chisquare with 6 d.o.f. = 4.96 p-value= .450798 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block3.rng using bits 2 to 25 2.074 duplicate number number spacings observed expected 0 69. 67.668 1 126. 135.335 2 123. 135.335 3 96. 90.224 4 60. 45.112 5 22. 18.045 6 to INF 4. 8.282 Chisquare with 6 d.o.f. = 10.16 p-value= .881871 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block3.rng using bits 3 to 26 1.974 duplicate number number spacings observed expected 0 63. 67.668 1 154. 135.335 2 130. 135.335 3 81. 90.224 4 43. 45.112 5 19. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = 4.56 p-value= .398019 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block3.rng using bits 4 to 27 1.966 duplicate number number spacings observed expected 0 63. 67.668 1 150. 135.335 2 132. 135.335 3 88. 90.224 4 45. 45.112 5 10. 18.045 6 to INF 12. 8.282 Chisquare with 6 d.o.f. = 7.30 p-value= .706362 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block3.rng using bits 5 to 28 2.016 duplicate number number spacings observed expected 0 56. 67.668 1 147. 135.335 2 135. 135.335 3 97. 90.224 4 40. 45.112 5 16. 18.045 6 to INF 9. 8.282 Chisquare with 6 d.o.f. = 4.40 p-value= .377313 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block3.rng using bits 6 to 29 1.994 duplicate number number spacings observed expected 0 72. 67.668 1 129. 135.335 2 133. 135.335 3 91. 90.224 4 53. 45.112 5 15. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 2.71 p-value= .156018 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block3.rng using bits 7 to 30 2.062 duplicate number number spacings observed expected 0 62. 67.668 1 132. 135.335 2 132. 135.335 3 100. 90.224 4 49. 45.112 5 15. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = 2.90 p-value= .179179 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block3.rng using bits 8 to 31 1.982 duplicate number number spacings observed expected 0 67. 67.668 1 139. 135.335 2 135. 135.335 3 90. 90.224 4 41. 45.112 5 22. 18.045 6 to INF 6. 8.282 Chisquare with 6 d.o.f. = 1.98 p-value= .078257 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block3.rng using bits 9 to 32 1.968 duplicate number number spacings observed expected 0 66. 67.668 1 145. 135.335 2 133. 135.335 3 91. 90.224 4 39. 45.112 5 18. 18.045 6 to INF 8. 8.282 Chisquare with 6 d.o.f. = 1.62 p-value= .048579 ::::::::::::::::::::::::::::::::::::::::: The 9 p-values were .450798 .881871 .398019 .706362 .377313 .156018 .179179 .078257 .048579 A KSTEST for the 9 p-values yields .727333 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block3.rng For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom= 96.461; p-value= .446464 OPERM5 test for file block3.rng For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=123.505; p-value= .951760 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block3.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 178 211.4 5.282254 5.282 29 5228 5134.0 1.720696 7.003 30 22946 23103.0 1.067553 8.071 31 11648 11551.5 .805741 8.876 chisquare= 8.876 for 3 d. of f.; p-value= .970462 -------------------------------------------------------------- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block3.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 268 211.4 15.143090 15.143 30 5076 5134.0 .655470 15.799 31 23102 23103.0 .000047 15.799 32 11554 11551.5 .000531 15.799 chisquare=15.799 for 3 d. of f.; p-value= .998788 -------------------------------------------------------------- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block3.rng Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 1 to 8 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 948 944.3 .014 .014 r =5 21954 21743.9 2.030 2.045 r =6 77098 77311.8 .591 2.636 p=1-exp(-SUM/2)= .73231 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 2 to 9 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 970 944.3 .699 .699 r =5 21850 21743.9 .518 1.217 r =6 77180 77311.8 .225 1.442 p=1-exp(-SUM/2)= .51369 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 3 to 10 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 922 944.3 .527 .527 r =5 21758 21743.9 .009 .536 r =6 77320 77311.8 .001 .537 p=1-exp(-SUM/2)= .23536 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 4 to 11 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 996 944.3 2.830 2.830 r =5 21700 21743.9 .089 2.919 r =6 77304 77311.8 .001 2.920 p=1-exp(-SUM/2)= .76774 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 5 to 12 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 951 944.3 .048 .048 r =5 21744 21743.9 .000 .048 r =6 77305 77311.8 .001 .048 p=1-exp(-SUM/2)= .02377 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 6 to 13 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 943 944.3 .002 .002 r =5 21700 21743.9 .089 .090 r =6 77357 77311.8 .026 .117 p=1-exp(-SUM/2)= .05675 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 7 to 14 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 958 944.3 .199 .199 r =5 21785 21743.9 .078 .276 r =6 77257 77311.8 .039 .315 p=1-exp(-SUM/2)= .14583 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 8 to 15 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 942 944.3 .006 .006 r =5 21770 21743.9 .031 .037 r =6 77288 77311.8 .007 .044 p=1-exp(-SUM/2)= .02189 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 9 to 16 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 921 944.3 .575 .575 r =5 21910 21743.9 1.269 1.844 r =6 77169 77311.8 .264 2.108 p=1-exp(-SUM/2)= .65138 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 10 to 17 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 961 944.3 .295 .295 r =5 21777 21743.9 .050 .346 r =6 77262 77311.8 .032 .378 p=1-exp(-SUM/2)= .17212 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 11 to 18 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 914 944.3 .972 .972 r =5 21844 21743.9 .461 1.433 r =6 77242 77311.8 .063 1.496 p=1-exp(-SUM/2)= .52673 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 12 to 19 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 938 944.3 .042 .042 r =5 21919 21743.9 1.410 1.452 r =6 77143 77311.8 .369 1.821 p=1-exp(-SUM/2)= .59761 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 13 to 20 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 955 944.3 .121 .121 r =5 22095 21743.9 5.669 5.790 r =6 76950 77311.8 1.693 7.484 p=1-exp(-SUM/2)= .97629 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 14 to 21 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 972 944.3 .812 .812 r =5 21674 21743.9 .225 1.037 r =6 77354 77311.8 .023 1.060 p=1-exp(-SUM/2)= .41146 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 15 to 22 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 947 944.3 .008 .008 r =5 21690 21743.9 .134 .141 r =6 77363 77311.8 .034 .175 p=1-exp(-SUM/2)= .08388 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 16 to 23 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 910 944.3 1.246 1.246 r =5 22038 21743.9 3.978 5.224 r =6 77052 77311.8 .873 6.097 p=1-exp(-SUM/2)= .95257 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 17 to 24 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 907 944.3 1.473 1.473 r =5 21945 21743.9 1.860 3.333 r =6 77148 77311.8 .347 3.680 p=1-exp(-SUM/2)= .84121 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 18 to 25 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 947 944.3 .008 .008 r =5 21578 21743.9 1.266 1.273 r =6 77475 77311.8 .344 1.618 p=1-exp(-SUM/2)= .55469 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 19 to 26 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 975 944.3 .998 .998 r =5 21720 21743.9 .026 1.024 r =6 77305 77311.8 .001 1.025 p=1-exp(-SUM/2)= .40096 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 20 to 27 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 993 944.3 2.511 2.511 r =5 21946 21743.9 1.878 4.390 r =6 77061 77311.8 .814 5.204 p=1-exp(-SUM/2)= .92586 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 21 to 28 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 975 944.3 .998 .998 r =5 21836 21743.9 .390 1.388 r =6 77189 77311.8 .195 1.583 p=1-exp(-SUM/2)= .54687 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 22 to 29 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 986 944.3 1.841 1.841 r =5 21867 21743.9 .697 2.538 r =6 77147 77311.8 .351 2.890 p=1-exp(-SUM/2)= .76420 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 23 to 30 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 951 944.3 .048 .048 r =5 21797 21743.9 .130 .177 r =6 77252 77311.8 .046 .223 p=1-exp(-SUM/2)= .10571 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 24 to 31 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 940 944.3 .020 .020 r =5 21777 21743.9 .050 .070 r =6 77283 77311.8 .011 .081 p=1-exp(-SUM/2)= .03955 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block3.rng b-rank test for bits 25 to 32 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 942 944.3 .006 .006 r =5 21773 21743.9 .039 .045 r =6 77285 77311.8 .009 .054 p=1-exp(-SUM/2)= .02656 TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices These should be 25 uniform [0,1] random variables: .732309 .513686 .235357 .767744 .023772 .056750 .145834 .021890 .651385 .172116 .526727 .597610 .976289 .411458 .083885 .952568 .841214 .554691 .400965 .925856 .546874 .764203 .105711 .039552 .026563 brank test summary for block3.rng The KS test for those 25 supposed UNI's yields KS p-value= .805665 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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: 141543 missing words, -.86 sigmas from mean, p-value= .19602 tst no 2: 142352 missing words, 1.03 sigmas from mean, p-value= .84950 tst no 3: 141698 missing words, -.49 sigmas from mean, p-value= .31074 tst no 4: 141445 missing words, -1.08 sigmas from mean, p-value= .13899 tst no 5: 142411 missing words, 1.17 sigmas from mean, p-value= .87943 tst no 6: 142308 missing words, .93 sigmas from mean, p-value= .82420 tst no 7: 141282 missing words, -1.47 sigmas from mean, p-value= .07136 tst no 8: 142059 missing words, .35 sigmas from mean, p-value= .63672 tst no 9: 141818 missing words, -.21 sigmas from mean, p-value= .41551 tst no 10: 141039 missing words, -2.03 sigmas from mean, p-value= .02100 tst no 11: 141849 missing words, -.14 sigmas from mean, p-value= .44395 tst no 12: 141853 missing words, -.13 sigmas from mean, p-value= .44765 tst no 13: 141787 missing words, -.29 sigmas from mean, p-value= .38751 tst no 14: 141854 missing words, -.13 sigmas from mean, p-value= .44857 tst no 15: 142041 missing words, .31 sigmas from mean, p-value= .62082 tst no 16: 142027 missing words, .27 sigmas from mean, p-value= .60832 tst no 17: 142106 missing words, .46 sigmas from mean, p-value= .67707 tst no 18: 141772 missing words, -.32 sigmas from mean, p-value= .37416 tst no 19: 142356 missing words, 1.04 sigmas from mean, p-value= .85167 tst no 20: 141874 missing words, -.08 sigmas from mean, p-value= .46711 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block3.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OPSO for block3.rng using bits 23 to 32 142294 1.326 .9077 OPSO for block3.rng using bits 22 to 31 141830 -.274 .3922 OPSO for block3.rng using bits 21 to 30 141767 -.491 .3118 OPSO for block3.rng using bits 20 to 29 141966 .195 .5775 OPSO for block3.rng using bits 19 to 28 142436 1.816 .9653 OPSO for block3.rng using bits 18 to 27 141697 -.732 .2320 OPSO for block3.rng using bits 17 to 26 141747 -.560 .2878 OPSO for block3.rng using bits 16 to 25 141758 -.522 .3009 OPSO for block3.rng using bits 15 to 24 141935 .089 .5353 OPSO for block3.rng using bits 14 to 23 141915 .020 .5078 OPSO for block3.rng using bits 13 to 22 141910 .002 .5009 OPSO for block3.rng using bits 12 to 21 141942 .113 .5449 OPSO for block3.rng using bits 11 to 20 141767 -.491 .3118 OPSO for block3.rng using bits 10 to 19 141807 -.353 .3621 OPSO for block3.rng using bits 9 to 18 141335 -1.980 .0238 OPSO for block3.rng using bits 8 to 17 141511 -1.374 .0848 OPSO for block3.rng using bits 7 to 16 141758 -.522 .3009 OPSO for block3.rng using bits 6 to 15 141903 -.022 .4913 OPSO for block3.rng using bits 5 to 14 142145 .813 .7918 OPSO for block3.rng using bits 4 to 13 142016 .368 .6435 OPSO for block3.rng using bits 3 to 12 142096 .644 .7401 OPSO for block3.rng using bits 2 to 11 142079 .585 .7208 OPSO for block3.rng using bits 1 to 10 141938 .099 .5394 OQSO test for generator block3.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OQSO for block3.rng using bits 28 to 32 141980 .240 .5947 OQSO for block3.rng using bits 27 to 31 141943 .114 .5454 OQSO for block3.rng using bits 26 to 30 142140 .782 .7829 OQSO for block3.rng using bits 25 to 29 142045 .460 .6772 OQSO for block3.rng using bits 24 to 28 141602 -1.042 .1488 OQSO for block3.rng using bits 23 to 27 141965 .189 .5748 OQSO for block3.rng using bits 22 to 26 141830 -.269 .3940 OQSO for block3.rng using bits 21 to 25 141683 -.767 .2215 OQSO for block3.rng using bits 20 to 24 141580 -1.116 .1321 OQSO for block3.rng using bits 19 to 23 142123 .724 .7656 OQSO for block3.rng using bits 18 to 22 142102 .653 .7432 OQSO for block3.rng using bits 17 to 21 141844 -.221 .4124 OQSO for block3.rng using bits 16 to 20 142382 1.602 .9455 OQSO for block3.rng using bits 15 to 19 141566 -1.164 .1222 OQSO for block3.rng using bits 14 to 18 141869 -.137 .4456 OQSO for block3.rng using bits 13 to 17 141911 .006 .5023 OQSO for block3.rng using bits 12 to 16 142176 .904 .8170 OQSO for block3.rng using bits 11 to 15 142000 .307 .6207 OQSO for block3.rng using bits 10 to 14 141814 -.323 .3733 OQSO for block3.rng using bits 9 to 13 142282 1.263 .8968 OQSO for block3.rng using bits 8 to 12 142158 .843 .8004 OQSO for block3.rng using bits 7 to 11 142002 .314 .6233 OQSO for block3.rng using bits 6 to 10 141375 -1.811 .0350 OQSO for block3.rng using bits 5 to 9 141745 -.557 .2887 OQSO for block3.rng using bits 4 to 8 141719 -.645 .2594 OQSO for block3.rng using bits 3 to 7 141992 .280 .6104 OQSO for block3.rng using bits 2 to 6 141966 .192 .5762 OQSO for block3.rng using bits 1 to 5 142118 .707 .7603 DNA test for generator block3.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p DNA for block3.rng using bits 31 to 32 141796 -.334 .3691 DNA for block3.rng using bits 30 to 31 141743 -.491 .3118 DNA for block3.rng using bits 29 to 30 141622 -.848 .1983 DNA for block3.rng using bits 28 to 29 141643 -.786 .2160 DNA for block3.rng using bits 27 to 28 141869 -.119 .4527 DNA for block3.rng using bits 26 to 27 142194 .840 .7995 DNA for block3.rng using bits 25 to 26 142230 .946 .8279 DNA for block3.rng using bits 24 to 25 141925 .046 .5184 DNA for block3.rng using bits 23 to 24 141860 -.146 .4422 DNA for block3.rng using bits 22 to 23 141837 -.213 .4155 DNA for block3.rng using bits 21 to 22 141860 -.146 .4422 DNA for block3.rng using bits 20 to 21 141683 -.668 .2522 DNA for block3.rng using bits 19 to 20 142454 1.607 .9459 DNA for block3.rng using bits 18 to 19 141938 .085 .5337 DNA for block3.rng using bits 17 to 18 141661 -.733 .2319 DNA for block3.rng using bits 16 to 17 141546 -1.072 .1419 DNA for block3.rng using bits 15 to 16 141922 .037 .5149 DNA for block3.rng using bits 14 to 15 141922 .037 .5149 DNA for block3.rng using bits 13 to 14 142113 .601 .7260 DNA for block3.rng using bits 12 to 13 141464 -1.314 .0945 DNA for block3.rng using bits 11 to 12 141567 -1.010 .1563 DNA for block3.rng using bits 10 to 11 141957 .141 .5559 DNA for block3.rng using bits 9 to 10 141672 -.700 .2419 DNA for block3.rng using bits 8 to 9 141588 -.948 .1716 DNA for block3.rng using bits 7 to 8 142070 .474 .6822 DNA for block3.rng using bits 6 to 7 142452 1.601 .9453 DNA for block3.rng using bits 5 to 6 142150 .710 .7611 DNA for block3.rng using bits 4 to 5 141867 -.125 .4503 DNA for block3.rng using bits 3 to 4 142282 1.099 .8642 DNA for block3.rng using bits 2 to 3 141848 -.181 .4282 DNA for block3.rng using bits 1 to 2 141186 -2.134 .0164 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block3.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 block3.rng 2481.78 -.258 .398350 byte stream for block3.rng 2530.09 .426 .664792 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 2502.17 .031 .512240 bits 2 to 9 2391.41 -1.536 .062312 bits 3 to 10 2478.35 -.306 .379749 bits 4 to 11 2461.14 -.550 .291325 bits 5 to 12 2466.26 -.477 .316638 bits 6 to 13 2515.79 .223 .588350 bits 7 to 14 2574.38 1.052 .853571 bits 8 to 15 2595.48 1.350 .911533 bits 9 to 16 2413.19 -1.228 .109779 bits 10 to 17 2515.39 .218 .586149 bits 11 to 18 2474.26 -.364 .357912 bits 12 to 19 2446.21 -.761 .223429 bits 13 to 20 2516.80 .238 .593913 bits 14 to 21 2527.37 .387 .650665 bits 15 to 22 2476.58 -.331 .370267 bits 16 to 23 2406.41 -1.324 .092826 bits 17 to 24 2445.97 -.764 .222393 bits 18 to 25 2508.31 .118 .546792 bits 19 to 26 2521.86 .309 .621399 bits 20 to 27 2490.58 -.133 .446987 bits 21 to 28 2561.37 .868 .807263 bits 22 to 29 2470.35 -.419 .337491 bits 23 to 30 2596.10 1.359 .912933 bits 24 to 31 2476.07 -.338 .367532 bits 25 to 32 2450.33 -.702 .241220 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block3.rng Of 12,000 tries, the average no. of successes should be 3523 with sigma=21.9 Successes: 3510 z-score: -.594 p-value: .276387 Successes: 3521 z-score: -.091 p-value: .463618 Successes: 3550 z-score: 1.233 p-value: .891189 Successes: 3519 z-score: -.183 p-value: .427537 Successes: 3519 z-score: -.183 p-value: .427537 Successes: 3515 z-score: -.365 p-value: .357445 Successes: 3506 z-score: -.776 p-value: .218799 Successes: 3552 z-score: 1.324 p-value: .907282 Successes: 3532 z-score: .411 p-value: .659449 Successes: 3514 z-score: -.411 p-value: .340551 square size avg. no. parked sample sigma 100. 3523.800 15.072 KSTEST for the above 10: p= .451665 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block3.rng Sample no. d^2 avg equiv uni 5 .3566 1.2487 .301211 10 .2498 1.2662 .222060 15 2.2682 1.1231 .897670 20 .2259 1.1401 .203071 25 .3029 1.1136 .262461 30 .7571 1.0964 .532772 35 .8437 1.0675 .571694 40 1.1572 1.1584 .687463 45 .2061 1.1185 .187072 50 1.3004 1.0809 .729338 55 .4219 1.0482 .345610 60 .4818 1.0364 .383794 65 .5123 1.0061 .402419 70 1.1150 .9850 .673903 75 .4943 .9704 .391531 80 1.8742 .9571 .847955 85 .1597 .9553 .148269 90 2.0265 .9646 .869536 95 1.3205 .9608 .734760 100 .6081 .9716 .457292 MINIMUM DISTANCE TEST for block3.rng Result of KS test on 20 transformed mindist^2's: p-value= .211625 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block3.rng sample no: 1 r^3= 42.873 p-value= .76048 sample no: 2 r^3= 25.552 p-value= .57333 sample no: 3 r^3= 24.719 p-value= .56131 sample no: 4 r^3= 5.416 p-value= .16517 sample no: 5 r^3= 15.757 p-value= .40858 sample no: 6 r^3= 43.326 p-value= .76406 sample no: 7 r^3= 2.055 p-value= .06621 sample no: 8 r^3= 37.658 p-value= .71500 sample no: 9 r^3= 12.371 p-value= .33792 sample no: 10 r^3= 30.587 p-value= .63924 sample no: 11 r^3= 17.624 p-value= .44426 sample no: 12 r^3= 21.512 p-value= .51182 sample no: 13 r^3= .120 p-value= .00398 sample no: 14 r^3= 18.439 p-value= .45917 sample no: 15 r^3= 14.804 p-value= .38949 sample no: 16 r^3= 32.237 p-value= .65856 sample no: 17 r^3= 86.750 p-value= .94452 sample no: 18 r^3= 6.576 p-value= .19683 sample no: 19 r^3= 5.668 p-value= .17216 sample no: 20 r^3= 8.877 p-value= .25614 A KS test is applied to those 20 p-values. --------------------------------------------------------- 3DSPHERES test for file block3.rng p-value= .411318 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block3.rng Table of standardized frequency counts ( (obs-exp)/sqrt(exp) )^2 for j taking values <=6,7,8,...,47,>=48: .6 .1 -.8 -.7 .2 1.2 -.6 -.8 .9 -1.3 -.6 -.1 -.2 -.6 1.5 .0 -1.0 .0 .6 -1.1 .3 .2 -1.0 .0 .6 -.5 1.1 .7 2.0 .8 .7 -.2 .1 2.1 .8 -.5 -.7 -.1 -1.6 -1.3 .9 2.0 .8 Chi-square with 42 degrees of freedom: 36.324 z-score= -.619 p-value= .282057 ______________________________________________________________ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 .864680 Test no. 2 p-value .519832 Test no. 3 p-value .883525 Test no. 4 p-value .860066 Test no. 5 p-value .519336 Test no. 6 p-value .526971 Test no. 7 p-value .842970 Test no. 8 p-value .611857 Test no. 9 p-value .540477 Test no. 10 p-value .350981 Results of the OSUM test for block3.rng KSTEST on the above 10 p-values: .913041 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block3.rng Up and down runs in a sample of 10000 _________________________________________________ Run test for block3.rng : runs up; ks test for 10 p's: .414940 runs down; ks test for 10 p's: .276074 Run test for block3.rng : runs up; ks test for 10 p's: .695511 runs down; ks test for 10 p's: .206234 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block3.rng No. of wins: Observed Expected 98657 98585.86 98657= No. of wins, z-score= .318 pvalue= .62483 Analysis of Throws-per-Game: Chisq= 27.83 for 20 degrees of freedom, p= .88641 Throws Observed Expected Chisq Sum 1 66161 66666.7 3.836 3.836 2 37705 37654.3 .068 3.904 3 27050 26954.7 .337 4.240 4 19665 19313.5 6.399 10.639 5 13731 13851.4 1.047 11.686 6 9942 9943.5 .000 11.686 7 7167 7145.0 .068 11.754 8 5138 5139.1 .000 11.754 9 3800 3699.9 2.710 14.464 10 2669 2666.3 .003 14.467 11 1976 1923.3 1.442 15.909 12 1391 1388.7 .004 15.913 13 971 1003.7 1.066 16.979 14 666 726.1 4.981 21.960 15 532 525.8 .072 22.033 16 411 381.2 2.338 24.370 17 268 276.5 .264 24.634 18 203 200.8 .023 24.657 19 166 146.0 2.744 27.402 20 110 106.2 .135 27.536 21 278 287.1 .289 27.826 SUMMARY FOR block3.rng p-value for no. of wins: .624827 p-value for throws/game: .886415 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Results of DIEHARD battery of tests sent to file report3.txt