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 block81.rng For a sample of size 500: mean block81.rng using bits 1 to 24 2.026 duplicate number number spacings observed expected 0 77. 67.668 1 131. 135.335 2 126. 135.335 3 81. 90.224 4 57. 45.112 5 15. 18.045 6 to INF 13. 8.282 Chisquare with 6 d.o.f. = 9.35 p-value= .845038 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block81.rng using bits 2 to 25 1.924 duplicate number number spacings observed expected 0 67. 67.668 1 144. 135.335 2 137. 135.335 3 88. 90.224 4 43. 45.112 5 18. 18.045 6 to INF 3. 8.282 Chisquare with 6 d.o.f. = 4.10 p-value= .337410 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block81.rng using bits 3 to 26 1.914 duplicate number number spacings observed expected 0 67. 67.668 1 150. 135.335 2 135. 135.335 3 82. 90.224 4 42. 45.112 5 21. 18.045 6 to INF 3. 8.282 Chisquare with 6 d.o.f. = 6.41 p-value= .621471 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block81.rng using bits 4 to 27 2.014 duplicate number number spacings observed expected 0 65. 67.668 1 145. 135.335 2 109. 135.335 3 111. 90.224 4 50. 45.112 5 11. 18.045 6 to INF 9. 8.282 Chisquare with 6 d.o.f. = 14.05 p-value= .970880 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block81.rng using bits 5 to 28 2.024 duplicate number number spacings observed expected 0 78. 67.668 1 124. 135.335 2 129. 135.335 3 87. 90.224 4 50. 45.112 5 26. 18.045 6 to INF 6. 8.282 Chisquare with 6 d.o.f. = 7.60 p-value= .731459 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block81.rng using bits 6 to 29 2.030 duplicate number number spacings observed expected 0 64. 67.668 1 139. 135.335 2 133. 135.335 3 90. 90.224 4 44. 45.112 5 20. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = .93 p-value= .012030 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block81.rng using bits 7 to 30 2.056 duplicate number number spacings observed expected 0 61. 67.668 1 143. 135.335 2 128. 135.335 3 88. 90.224 4 46. 45.112 5 24. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = 3.88 p-value= .307473 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block81.rng using bits 8 to 31 1.934 duplicate number number spacings observed expected 0 69. 67.668 1 135. 135.335 2 148. 135.335 3 87. 90.224 4 36. 45.112 5 20. 18.045 6 to INF 5. 8.282 Chisquare with 6 d.o.f. = 4.68 p-value= .414561 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block81.rng using bits 9 to 32 1.964 duplicate number number spacings observed expected 0 64. 67.668 1 158. 135.335 2 116. 135.335 3 90. 90.224 4 48. 45.112 5 16. 18.045 6 to INF 8. 8.282 Chisquare with 6 d.o.f. = 7.18 p-value= .695803 ::::::::::::::::::::::::::::::::::::::::: The 9 p-values were .845038 .337410 .621471 .970880 .731459 .012030 .307473 .414561 .695803 A KSTEST for the 9 p-values yields .157137 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block81.rng For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=105.168; p-value= .683291 OPERM5 test for file block81.rng For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=125.107; p-value= .960794 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block81.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 217 211.4 .147379 .147 29 5124 5134.0 .019518 .167 30 23279 23103.0 1.340061 1.507 31 11380 11551.5 2.546904 4.054 chisquare= 4.054 for 3 d. of f.; p-value= .766329 -------------------------------------------------------------- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block81.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 200 211.4 .616651 .617 30 5124 5134.0 .019518 .636 31 23051 23103.0 .117252 .753 32 11625 11551.5 .467355 1.221 chisquare= 1.221 for 3 d. of f.; p-value= .386579 -------------------------------------------------------------- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block81.rng Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.rng b-rank test for bits 1 to 8 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 960 944.3 .261 .261 r =5 21770 21743.9 .031 .292 r =6 77270 77311.8 .023 .315 p=1-exp(-SUM/2)= .14569 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.rng b-rank test for bits 2 to 9 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 953 944.3 .080 .080 r =5 21809 21743.9 .195 .275 r =6 77238 77311.8 .070 .345 p=1-exp(-SUM/2)= .15865 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.rng b-rank test for bits 3 to 10 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 914 944.3 .972 .972 r =5 21683 21743.9 .171 1.143 r =6 77403 77311.8 .108 1.250 p=1-exp(-SUM/2)= .46486 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.rng b-rank test for bits 4 to 11 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 959 944.3 .229 .229 r =5 21831 21743.9 .349 .578 r =6 77210 77311.8 .134 .712 p=1-exp(-SUM/2)= .29944 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.rng b-rank test for bits 5 to 12 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 912 944.3 1.105 1.105 r =5 21797 21743.9 .130 1.235 r =6 77291 77311.8 .006 1.240 p=1-exp(-SUM/2)= .46211 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.rng b-rank test for bits 6 to 13 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 924 944.3 .436 .436 r =5 21583 21743.9 1.191 1.627 r =6 77493 77311.8 .425 2.052 p=1-exp(-SUM/2)= .64152 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.rng b-rank test for bits 7 to 14 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 930 944.3 .217 .217 r =5 21726 21743.9 .015 .231 r =6 77344 77311.8 .013 .245 p=1-exp(-SUM/2)= .11518 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.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 21750 21743.9 .002 .007 r =6 77308 77311.8 .000 .008 p=1-exp(-SUM/2)= .00375 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.rng b-rank test for bits 9 to 16 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 928 944.3 .281 .281 r =5 21671 21743.9 .244 .526 r =6 77401 77311.8 .103 .629 p=1-exp(-SUM/2)= .26974 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.rng b-rank test for bits 10 to 17 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 929 944.3 .248 .248 r =5 21792 21743.9 .106 .354 r =6 77279 77311.8 .014 .368 p=1-exp(-SUM/2)= .16817 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.rng b-rank test for bits 11 to 18 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 953 944.3 .080 .080 r =5 21792 21743.9 .106 .187 r =6 77255 77311.8 .042 .228 p=1-exp(-SUM/2)= .10786 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.rng b-rank test for bits 12 to 19 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 928 944.3 .281 .281 r =5 21948 21743.9 1.916 2.197 r =6 77124 77311.8 .456 2.653 p=1-exp(-SUM/2)= .73465 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.rng b-rank test for bits 13 to 20 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 946 944.3 .003 .003 r =5 21861 21743.9 .631 .634 r =6 77193 77311.8 .183 .816 p=1-exp(-SUM/2)= .33510 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.rng b-rank test for bits 14 to 21 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 873 944.3 5.384 5.384 r =5 21992 21743.9 2.831 8.215 r =6 77135 77311.8 .404 8.619 p=1-exp(-SUM/2)= .98656 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.rng b-rank test for bits 15 to 22 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 957 944.3 .171 .171 r =5 21767 21743.9 .025 .195 r =6 77276 77311.8 .017 .212 p=1-exp(-SUM/2)= .10053 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.rng b-rank test for bits 16 to 23 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 931 944.3 .187 .187 r =5 21507 21743.9 2.581 2.768 r =6 77562 77311.8 .810 3.578 p=1-exp(-SUM/2)= .83288 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.rng b-rank test for bits 17 to 24 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 954 944.3 .100 .100 r =5 21653 21743.9 .380 .480 r =6 77393 77311.8 .085 .565 p=1-exp(-SUM/2)= .24606 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.rng b-rank test for bits 18 to 25 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 923 944.3 .481 .481 r =5 21694 21743.9 .115 .595 r =6 77383 77311.8 .066 .661 p=1-exp(-SUM/2)= .28129 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.rng b-rank test for bits 19 to 26 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 920 944.3 .625 .625 r =5 21614 21743.9 .776 1.401 r =6 77466 77311.8 .308 1.709 p=1-exp(-SUM/2)= .57450 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.rng b-rank test for bits 20 to 27 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 953 944.3 .080 .080 r =5 21882 21743.9 .877 .957 r =6 77165 77311.8 .279 1.236 p=1-exp(-SUM/2)= .46098 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.rng b-rank test for bits 21 to 28 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 944 944.3 .000 .000 r =5 21893 21743.9 1.022 1.022 r =6 77163 77311.8 .286 1.309 p=1-exp(-SUM/2)= .48027 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.rng b-rank test for bits 22 to 29 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 block81.rng b-rank test for bits 23 to 30 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 921 944.3 .575 .575 r =5 21559 21743.9 1.572 2.147 r =6 77520 77311.8 .561 2.708 p=1-exp(-SUM/2)= .74179 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.rng b-rank test for bits 24 to 31 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 935 944.3 .092 .092 r =5 21747 21743.9 .000 .092 r =6 77318 77311.8 .000 .093 p=1-exp(-SUM/2)= .04522 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block81.rng b-rank test for bits 25 to 32 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 967 944.3 .546 .546 r =5 21720 21743.9 .026 .572 r =6 77313 77311.8 .000 .572 p=1-exp(-SUM/2)= .24870 TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices These should be 25 uniform [0,1] random variables: .145689 .158648 .464863 .299439 .462105 .641517 .115176 .003746 .269745 .168172 .107862 .734649 .335104 .986559 .100526 .832879 .246064 .281287 .574496 .460976 .480270 .124424 .741787 .045223 .248704 brank test summary for block81.rng The KS test for those 25 supposed UNI's yields KS p-value= .977005 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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: 142577 missing words, 1.56 sigmas from mean, p-value= .94062 tst no 2: 141834 missing words, -.18 sigmas from mean, p-value= .43015 tst no 3: 141910 missing words, .00 sigmas from mean, p-value= .50063 tst no 4: 142088 missing words, .42 sigmas from mean, p-value= .66183 tst no 5: 142325 missing words, .97 sigmas from mean, p-value= .83427 tst no 6: 141243 missing words, -1.56 sigmas from mean, p-value= .05975 tst no 7: 141599 missing words, -.73 sigmas from mean, p-value= .23421 tst no 8: 141530 missing words, -.89 sigmas from mean, p-value= .18773 tst no 9: 141763 missing words, -.34 sigmas from mean, p-value= .36622 tst no 10: 141423 missing words, -1.14 sigmas from mean, p-value= .12792 tst no 11: 142072 missing words, .38 sigmas from mean, p-value= .64805 tst no 12: 141501 missing words, -.95 sigmas from mean, p-value= .17003 tst no 13: 142599 missing words, 1.61 sigmas from mean, p-value= .94645 tst no 14: 141866 missing words, -.10 sigmas from mean, p-value= .45968 tst no 15: 141814 missing words, -.22 sigmas from mean, p-value= .41187 tst no 16: 142124 missing words, .50 sigmas from mean, p-value= .69201 tst no 17: 141673 missing words, -.55 sigmas from mean, p-value= .29042 tst no 18: 142119 missing words, .49 sigmas from mean, p-value= .68789 tst no 19: 141844 missing words, -.15 sigmas from mean, p-value= .43934 tst no 20: 141701 missing words, -.49 sigmas from mean, p-value= .31322 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block81.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OPSO for block81.rng using bits 23 to 32 142037 .440 .6701 OPSO for block81.rng using bits 22 to 31 142186 .954 .8300 OPSO for block81.rng using bits 21 to 30 142427 1.785 .9629 OPSO for block81.rng using bits 20 to 29 142231 1.109 .8663 OPSO for block81.rng using bits 19 to 28 141911 .006 .5023 OPSO for block81.rng using bits 18 to 27 141826 -.287 .3869 OPSO for block81.rng using bits 17 to 26 142463 1.909 .9719 OPSO for block81.rng using bits 16 to 25 141666 -.839 .2007 OPSO for block81.rng using bits 15 to 24 142071 .557 .7114 OPSO for block81.rng using bits 14 to 23 141631 -.960 .1686 OPSO for block81.rng using bits 13 to 22 141455 -1.567 .0586 OPSO for block81.rng using bits 12 to 21 142034 .430 .6664 OPSO for block81.rng using bits 11 to 20 141560 -1.205 .1142 OPSO for block81.rng using bits 10 to 19 141106 -2.770 .0028 OPSO for block81.rng using bits 9 to 18 141984 .257 .6016 OPSO for block81.rng using bits 8 to 17 142264 1.223 .8893 OPSO for block81.rng using bits 7 to 16 141670 -.825 .2046 OPSO for block81.rng using bits 6 to 15 141555 -1.222 .1109 OPSO for block81.rng using bits 5 to 14 141413 -1.711 .0435 OPSO for block81.rng using bits 4 to 13 141835 -.256 .3989 OPSO for block81.rng using bits 3 to 12 141924 .051 .5202 OPSO for block81.rng using bits 2 to 11 141950 .140 .5558 OPSO for block81.rng using bits 1 to 10 142088 .616 .7311 OQSO test for generator block81.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OQSO for block81.rng using bits 28 to 32 141873 -.123 .4510 OQSO for block81.rng using bits 27 to 31 141901 -.028 .4887 OQSO for block81.rng using bits 26 to 30 141544 -1.238 .1078 OQSO for block81.rng using bits 25 to 29 140884 -3.476 .0003 OQSO for block81.rng using bits 24 to 28 141528 -1.293 .0981 OQSO for block81.rng using bits 23 to 27 141368 -1.835 .0333 OQSO for block81.rng using bits 22 to 26 142013 .351 .6374 OQSO for block81.rng using bits 21 to 25 141924 .050 .5198 OQSO for block81.rng using bits 20 to 24 142169 .880 .8106 OQSO for block81.rng using bits 19 to 23 141886 -.079 .4685 OQSO for block81.rng using bits 18 to 22 142137 .772 .7799 OQSO for block81.rng using bits 17 to 21 142075 .562 .7128 OQSO for block81.rng using bits 16 to 20 142055 .494 .6893 OQSO for block81.rng using bits 15 to 19 141941 .107 .5427 OQSO for block81.rng using bits 14 to 18 142217 1.043 .8515 OQSO for block81.rng using bits 13 to 17 142352 1.501 .9333 OQSO for block81.rng using bits 12 to 16 142606 2.362 .9909 OQSO for block81.rng using bits 11 to 15 141940 .104 .5414 OQSO for block81.rng using bits 10 to 14 141623 -.971 .1659 OQSO for block81.rng using bits 9 to 13 142119 .711 .7614 OQSO for block81.rng using bits 8 to 12 141798 -.377 .3529 OQSO for block81.rng using bits 7 to 11 141922 .043 .5171 OQSO for block81.rng using bits 6 to 10 142072 .551 .7093 OQSO for block81.rng using bits 5 to 9 142396 1.650 .9505 OQSO for block81.rng using bits 4 to 8 141699 -.713 .2379 OQSO for block81.rng using bits 3 to 7 141568 -1.157 .1236 OQSO for block81.rng using bits 2 to 6 142189 .948 .8284 OQSO for block81.rng using bits 1 to 5 141733 -.598 .2750 DNA test for generator block81.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p DNA for block81.rng using bits 31 to 32 142281 1.096 .8635 DNA for block81.rng using bits 30 to 31 141623 -.845 .1992 DNA for block81.rng using bits 29 to 30 142139 .677 .7510 DNA for block81.rng using bits 28 to 29 142265 1.049 .8530 DNA for block81.rng using bits 27 to 28 141839 -.207 .4178 DNA for block81.rng using bits 26 to 27 141505 -1.193 .1165 DNA for block81.rng using bits 25 to 26 141720 -.558 .2883 DNA for block81.rng using bits 24 to 25 141888 -.063 .4749 DNA for block81.rng using bits 23 to 24 141899 -.030 .4878 DNA for block81.rng using bits 22 to 23 141975 .194 .5768 DNA for block81.rng using bits 21 to 22 141714 -.576 .2822 DNA for block81.rng using bits 20 to 21 141498 -1.213 .1125 DNA for block81.rng using bits 19 to 20 141735 -.514 .3035 DNA for block81.rng using bits 18 to 19 141775 -.396 .3460 DNA for block81.rng using bits 17 to 18 141681 -.674 .2503 DNA for block81.rng using bits 16 to 17 141927 .052 .5208 DNA for block81.rng using bits 15 to 16 141937 .082 .5325 DNA for block81.rng using bits 14 to 15 141989 .235 .5929 DNA for block81.rng using bits 13 to 14 141330 -1.709 .0437 DNA for block81.rng using bits 12 to 13 142212 .893 .8140 DNA for block81.rng using bits 11 to 12 141908 -.004 .4984 DNA for block81.rng using bits 10 to 11 141952 .126 .5501 DNA for block81.rng using bits 9 to 10 141968 .173 .5687 DNA for block81.rng using bits 8 to 9 142158 .734 .7684 DNA for block81.rng using bits 7 to 8 141832 -.228 .4098 DNA for block81.rng using bits 6 to 7 142287 1.114 .8674 DNA for block81.rng using bits 5 to 6 142039 .383 .6490 DNA for block81.rng using bits 4 to 5 141593 -.933 .1754 DNA for block81.rng using bits 3 to 4 141971 .182 .5722 DNA for block81.rng using bits 2 to 3 141824 -.252 .4006 DNA for block81.rng using bits 1 to 2 142241 .978 .8361 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block81.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 block81.rng 2401.67 -1.391 .082175 byte stream for block81.rng 2486.54 -.190 .424504 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 2554.75 .774 .780604 bits 2 to 9 2540.12 .567 .714759 bits 3 to 10 2538.90 .550 .708885 bits 4 to 11 2516.71 .236 .593389 bits 5 to 12 2611.88 1.582 .943202 bits 6 to 13 2607.72 1.523 .936170 bits 7 to 14 2484.12 -.225 .411172 bits 8 to 15 2449.34 -.716 .236842 bits 9 to 16 2501.26 .018 .507133 bits 10 to 17 2458.41 -.588 .278208 bits 11 to 18 2457.82 -.597 .275402 bits 12 to 19 2378.75 -1.715 .043191 bits 13 to 20 2535.36 .500 .691490 bits 14 to 21 2453.31 -.660 .254539 bits 15 to 22 2519.06 .270 .606266 bits 16 to 23 2488.34 -.165 .434527 bits 17 to 24 2413.81 -1.219 .111446 bits 18 to 25 2586.58 1.224 .889592 bits 19 to 26 2564.03 .905 .817394 bits 20 to 27 2556.11 .794 .786270 bits 21 to 28 2468.71 -.442 .329080 bits 22 to 29 2536.33 .514 .696295 bits 23 to 30 2444.12 -.790 .214672 bits 24 to 31 2457.82 -.597 .275419 bits 25 to 32 2572.69 1.028 .848036 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block81.rng Of 12,000 tries, the average no. of successes should be 3523 with sigma=21.9 Successes: 3546 z-score: 1.050 p-value: .853193 Successes: 3537 z-score: .639 p-value: .738676 Successes: 3562 z-score: 1.781 p-value: .962529 Successes: 3538 z-score: .685 p-value: .753306 Successes: 3528 z-score: .228 p-value: .590298 Successes: 3499 z-score: -1.096 p-value: .136563 Successes: 3488 z-score: -1.598 p-value: .055002 Successes: 3497 z-score: -1.187 p-value: .117571 Successes: 3504 z-score: -.868 p-value: .192812 Successes: 3558 z-score: 1.598 p-value: .944998 square size avg. no. parked sample sigma 100. 3525.700 25.478 KSTEST for the above 10: p= .525125 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block81.rng Sample no. d^2 avg equiv uni 5 .5897 .5142 .447130 10 1.5814 1.0295 .795951 15 1.5120 1.1551 .781197 20 1.3881 .9827 .752181 25 .1764 .8506 .162462 30 .4204 .9080 .344601 35 1.2257 .9806 .708256 40 .0163 .9042 .016239 45 6.9403 1.0352 .999065 50 .2630 1.0050 .232261 55 .3882 .9823 .323045 60 .2684 .9917 .236435 65 1.7984 1.0317 .835921 70 .0889 1.0703 .085455 75 .0977 1.0397 .093561 80 .2546 1.0311 .225760 85 .3269 1.1037 .280016 90 .1627 1.1045 .150857 95 .3400 1.0850 .289478 100 2.3068 1.1025 .901564 MINIMUM DISTANCE TEST for block81.rng Result of KS test on 20 transformed mindist^2's: p-value= .310758 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block81.rng sample no: 1 r^3= 23.499 p-value= .54311 sample no: 2 r^3= 5.530 p-value= .16834 sample no: 3 r^3= .299 p-value= .00990 sample no: 4 r^3= 15.568 p-value= .40485 sample no: 5 r^3= 4.477 p-value= .13864 sample no: 6 r^3= 38.128 p-value= .71943 sample no: 7 r^3= 25.883 p-value= .57801 sample no: 8 r^3= 31.915 p-value= .65487 sample no: 9 r^3= 6.952 p-value= .20685 sample no: 10 r^3= 26.767 p-value= .59026 sample no: 11 r^3= 118.216 p-value= .98056 sample no: 12 r^3= 11.457 p-value= .31743 sample no: 13 r^3= 16.224 p-value= .41773 sample no: 14 r^3= 11.192 p-value= .31137 sample no: 15 r^3= 74.043 p-value= .91526 sample no: 16 r^3= 42.725 p-value= .75929 sample no: 17 r^3= .505 p-value= .01668 sample no: 18 r^3= 29.513 p-value= .62610 sample no: 19 r^3= 8.572 p-value= .24854 sample no: 20 r^3= 46.185 p-value= .78551 A KS test is applied to those 20 p-values. --------------------------------------------------------- 3DSPHERES test for file block81.rng p-value= .102165 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block81.rng Table of standardized frequency counts ( (obs-exp)/sqrt(exp) )^2 for j taking values <=6,7,8,...,47,>=48: -.8 -.7 .1 -.4 1.9 .3 .7 1.3 .0 -1.7 1.4 -1.2 -.2 .2 -1.5 .4 1.3 -.3 1.9 -.8 -.6 .1 .3 .8 -1.1 -1.1 -.4 -1.3 .5 .6 .3 .6 .3 -1.3 1.0 -.7 -.2 .5 -.4 -1.8 -1.3 -1.0 -1.1 Chi-square with 42 degrees of freedom: 39.632 z-score= -.258 p-value= .424388 ______________________________________________________________ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 .990656 Test no. 2 p-value .980718 Test no. 3 p-value .052224 Test no. 4 p-value .787836 Test no. 5 p-value .277596 Test no. 6 p-value .410163 Test no. 7 p-value .622199 Test no. 8 p-value .317145 Test no. 9 p-value .195164 Test no. 10 p-value .572178 Results of the OSUM test for block81.rng KSTEST on the above 10 p-values: .332689 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block81.rng Up and down runs in a sample of 10000 _________________________________________________ Run test for block81.rng : runs up; ks test for 10 p's: .292012 runs down; ks test for 10 p's: .347050 Run test for block81.rng : runs up; ks test for 10 p's: .525688 runs down; ks test for 10 p's: .635973 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block81.rng No. of wins: Observed Expected 97992 98585.86 97992= No. of wins, z-score=-2.656 pvalue= .00395 Analysis of Throws-per-Game: Chisq= 28.59 for 20 degrees of freedom, p= .90386 Throws Observed Expected Chisq Sum 1 66420 66666.7 .913 .913 2 37606 37654.3 .062 .975 3 27335 26954.7 5.365 6.339 4 19054 19313.5 3.486 9.825 5 13951 13851.4 .716 10.541 6 9989 9943.5 .208 10.749 7 7202 7145.0 .454 11.203 8 5152 5139.1 .033 11.236 9 3597 3699.9 2.860 14.096 10 2654 2666.3 .057 14.152 11 2012 1923.3 4.088 18.240 12 1348 1388.7 1.195 19.435 13 969 1003.7 1.201 20.636 14 775 726.1 3.288 23.924 15 512 525.8 .364 24.288 16 405 381.2 1.492 25.780 17 285 276.5 .259 26.039 18 184 200.8 1.410 27.449 19 139 146.0 .334 27.783 20 112 106.2 .315 28.098 21 299 287.1 .492 28.590 SUMMARY FOR block81.rng p-value for no. of wins: .003953 p-value for throws/game: .903856 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Results of DIEHARD battery of tests sent to file report81.txt