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 bbs.32 For a sample of size 500: mean bbs.32 using bits 1 to 24 1.926 duplicate number number spacings observed expected 0 72. 67.668 1 143. 135.335 2 125. 135.335 3 99. 90.224 4 41. 45.112 5 14. 18.045 6 to INF 6. 8.282 Chisquare with 6 d.o.f. = 4.26 p-value= .359077 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean bbs.32 using bits 2 to 25 1.960 duplicate number number spacings observed expected 0 71. 67.668 1 133. 135.335 2 152. 135.335 3 73. 90.224 4 39. 45.112 5 26. 18.045 6 to INF 6. 8.282 Chisquare with 6 d.o.f. = 10.51 p-value= .895186 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean bbs.32 using bits 3 to 26 2.090 duplicate number number spacings observed expected 0 54. 67.668 1 135. 135.335 2 133. 135.335 3 102. 90.224 4 50. 45.112 5 18. 18.045 6 to INF 8. 8.282 Chisquare with 6 d.o.f. = 4.88 p-value= .440480 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean bbs.32 using bits 4 to 27 1.978 duplicate number number spacings observed expected 0 67. 67.668 1 144. 135.335 2 123. 135.335 3 99. 90.224 4 42. 45.112 5 19. 18.045 6 to INF 6. 8.282 Chisquare with 6 d.o.f. = 3.43 p-value= .247177 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean bbs.32 using bits 5 to 28 1.932 duplicate number number spacings observed expected 0 64. 67.668 1 147. 135.335 2 144. 135.335 3 86. 90.224 4 32. 45.112 5 19. 18.045 6 to INF 8. 8.282 Chisquare with 6 d.o.f. = 5.83 p-value= .557240 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean bbs.32 using bits 6 to 29 1.986 duplicate number number spacings observed expected 0 62. 67.668 1 145. 135.335 2 137. 135.335 3 92. 90.224 4 37. 45.112 5 16. 18.045 6 to INF 11. 8.282 Chisquare with 6 d.o.f. = 3.80 p-value= .296657 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean bbs.32 using bits 7 to 30 1.914 duplicate number number spacings observed expected 0 66. 67.668 1 147. 135.335 2 133. 135.335 3 92. 90.224 4 46. 45.112 5 12. 18.045 6 to INF 4. 8.282 Chisquare with 6 d.o.f. = 5.38 p-value= .503665 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean bbs.32 using bits 8 to 31 1.874 duplicate number number spacings observed expected 0 66. 67.668 1 151. 135.335 2 137. 135.335 3 93. 90.224 4 37. 45.112 5 12. 18.045 6 to INF 4. 8.282 Chisquare with 6 d.o.f. = 7.66 p-value= .735709 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean bbs.32 using bits 9 to 32 2.060 duplicate number number spacings observed expected 0 62. 67.668 1 140. 135.335 2 121. 135.335 3 103. 90.224 4 46. 45.112 5 18. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = 4.34 p-value= .368865 ::::::::::::::::::::::::::::::::::::::::: The 9 p-values were .359077 .895186 .440480 .247177 .557240 .296657 .503665 .735709 .368865 A KSTEST for the 9 p-values yields .464784 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 bbs.32 For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=108.056; p-value= .749294 OPERM5 test for file bbs.32 For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=100.789; p-value= .568978 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 bbs.32 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 224 211.4 .748784 .749 29 5147 5134.0 .032866 .782 30 23153 23103.0 .108008 .890 31 11476 11551.5 .493782 1.383 chisquare= 1.383 for 3 d. of f.; p-value= .410337 -------------------------------------------------------------- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 bbs.32 Rank test for 32x32 binary matrices: rows from leftmost 32 bits of each 32-bit integer rank observed expected (o-e)^2/e sum 29 206 211.4 .138848 .139 30 5158 5134.0 .112097 .251 31 23104 23103.0 .000039 .251 32 11532 11551.5 .033000 .284 chisquare= .284 for 3 d. of f.; p-value= .334039 -------------------------------------------------------------- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 bbs.32 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 1 to 8 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 911 944.3 1.174 1.174 r =5 21551 21743.9 1.711 2.886 r =6 77538 77311.8 .662 3.547 p=1-exp(-SUM/2)= .83030 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 2 to 9 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 955 944.3 .121 .121 r =5 21633 21743.9 .566 .687 r =6 77412 77311.8 .130 .817 p=1-exp(-SUM/2)= .33525 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 3 to 10 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 996 944.3 2.830 2.830 r =5 21838 21743.9 .407 3.238 r =6 77166 77311.8 .275 3.513 p=1-exp(-SUM/2)= .82732 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 4 to 11 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 897 944.3 2.369 2.369 r =5 21849 21743.9 .508 2.877 r =6 77254 77311.8 .043 2.921 p=1-exp(-SUM/2)= .76783 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 5 to 12 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 880 944.3 4.379 4.379 r =5 21809 21743.9 .195 4.573 r =6 77311 77311.8 .000 4.573 p=1-exp(-SUM/2)= .89840 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 6 to 13 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 918 944.3 .733 .733 r =5 21729 21743.9 .010 .743 r =6 77353 77311.8 .022 .765 p=1-exp(-SUM/2)= .31775 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 7 to 14 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 943 944.3 .002 .002 r =5 21649 21743.9 .414 .416 r =6 77408 77311.8 .120 .536 p=1-exp(-SUM/2)= .23497 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 8 to 15 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 968 944.3 .595 .595 r =5 21688 21743.9 .144 .738 r =6 77344 77311.8 .013 .752 p=1-exp(-SUM/2)= .31336 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 9 to 16 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 972 944.3 .812 .812 r =5 21527 21743.9 2.164 2.976 r =6 77501 77311.8 .463 3.439 p=1-exp(-SUM/2)= .82085 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 10 to 17 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 942 944.3 .006 .006 r =5 21936 21743.9 1.697 1.703 r =6 77122 77311.8 .466 2.169 p=1-exp(-SUM/2)= .66188 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 11 to 18 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 887 944.3 3.477 3.477 r =5 21820 21743.9 .266 3.743 r =6 77293 77311.8 .005 3.748 p=1-exp(-SUM/2)= .84649 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 12 to 19 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 918 944.3 .733 .733 r =5 21623 21743.9 .672 1.405 r =6 77459 77311.8 .280 1.685 p=1-exp(-SUM/2)= .56938 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 13 to 20 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 910 944.3 1.246 1.246 r =5 21573 21743.9 1.343 2.589 r =6 77517 77311.8 .545 3.134 p=1-exp(-SUM/2)= .79131 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 14 to 21 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 945 944.3 .001 .001 r =5 21730 21743.9 .009 .009 r =6 77325 77311.8 .002 .012 p=1-exp(-SUM/2)= .00581 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 15 to 22 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 959 944.3 .229 .229 r =5 21794 21743.9 .115 .344 r =6 77247 77311.8 .054 .399 p=1-exp(-SUM/2)= .18068 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 16 to 23 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 963 944.3 .370 .370 r =5 21918 21743.9 1.394 1.764 r =6 77119 77311.8 .481 2.245 p=1-exp(-SUM/2)= .67455 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 17 to 24 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 968 944.3 .595 .595 r =5 21842 21743.9 .443 1.037 r =6 77190 77311.8 .192 1.229 p=1-exp(-SUM/2)= .45916 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 18 to 25 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 911 944.3 1.174 1.174 r =5 21493 21743.9 2.895 4.069 r =6 77596 77311.8 1.045 5.114 p=1-exp(-SUM/2)= .92247 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 19 to 26 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 880 944.3 4.379 4.379 r =5 21592 21743.9 1.061 5.440 r =6 77528 77311.8 .605 6.044 p=1-exp(-SUM/2)= .95130 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 20 to 27 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 941 944.3 .012 .012 r =5 21655 21743.9 .363 .375 r =6 77404 77311.8 .110 .485 p=1-exp(-SUM/2)= .21532 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 21 to 28 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 944 944.3 .000 .000 r =5 21757 21743.9 .008 .008 r =6 77299 77311.8 .002 .010 p=1-exp(-SUM/2)= .00504 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 22 to 29 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 926 944.3 .355 .355 r =5 21703 21743.9 .077 .432 r =6 77371 77311.8 .045 .477 p=1-exp(-SUM/2)= .21217 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 23 to 30 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 957 944.3 .171 .171 r =5 21597 21743.9 .992 1.163 r =6 77446 77311.8 .233 1.396 p=1-exp(-SUM/2)= .50246 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 24 to 31 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 918 944.3 .733 .733 r =5 21763 21743.9 .017 .749 r =6 77319 77311.8 .001 .750 p=1-exp(-SUM/2)= .31271 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG bbs.32 b-rank test for bits 25 to 32 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 978 944.3 1.203 1.203 r =5 21575 21743.9 1.312 2.515 r =6 77447 77311.8 .236 2.751 p=1-exp(-SUM/2)= .74728 TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices These should be 25 uniform [0,1] random variables: .830304 .335251 .827319 .767834 .898401 .317751 .234967 .313355 .820853 .661882 .846493 .569375 .791310 .005811 .180676 .674548 .459155 .922470 .951303 .215319 .005042 .212172 .502458 .312713 .747283 brank test summary for bbs.32 The KS test for those 25 supposed UNI's yields KS p-value= .489480 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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: 141941 missing words, .07 sigmas from mean, p-value= .52949 tst no 2: 142006 missing words, .23 sigmas from mean, p-value= .58935 tst no 3: 142560 missing words, 1.52 sigmas from mean, p-value= .93578 tst no 4: 141882 missing words, -.06 sigmas from mean, p-value= .47454 tst no 5: 141850 missing words, -.14 sigmas from mean, p-value= .44488 tst no 6: 141636 missing words, -.64 sigmas from mean, p-value= .26154 tst no 7: 141596 missing words, -.73 sigmas from mean, p-value= .23206 tst no 8: 141217 missing words, -1.62 sigmas from mean, p-value= .05288 tst no 9: 142129 missing words, .51 sigmas from mean, p-value= .69611 tst no 10: 141929 missing words, .05 sigmas from mean, p-value= .51833 tst no 11: 141610 missing words, -.70 sigmas from mean, p-value= .24216 tst no 12: 141338 missing words, -1.33 sigmas from mean, p-value= .09096 tst no 13: 142410 missing words, 1.17 sigmas from mean, p-value= .87896 tst no 14: 141810 missing words, -.23 sigmas from mean, p-value= .40824 tst no 15: 140993 missing words, -2.14 sigmas from mean, p-value= .01614 tst no 16: 141832 missing words, -.18 sigmas from mean, p-value= .42831 tst no 17: 142000 missing words, .21 sigmas from mean, p-value= .58389 tst no 18: 141327 missing words, -1.36 sigmas from mean, p-value= .08682 tst no 19: 141897 missing words, -.03 sigmas from mean, p-value= .48851 tst no 20: 141759 missing words, -.35 sigmas from mean, p-value= .36271 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 bbs.32 Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OPSO for bbs.32 using bits 23 to 32 786515******* 1.0000 OPSO for bbs.32 using bits 22 to 31 781523******* 1.0000 OPSO for bbs.32 using bits 21 to 30 780165******* 1.0000 OPSO for bbs.32 using bits 20 to 29 780450******* 1.0000 OPSO for bbs.32 using bits 19 to 28 786514******* 1.0000 OPSO for bbs.32 using bits 18 to 27 786521******* 1.0000 OPSO for bbs.32 using bits 17 to 26 786524******* 1.0000 OPSO for bbs.32 using bits 16 to 25 533946******* 1.0000 OPSO for bbs.32 using bits 15 to 24 142636 2.506 .9939 OPSO for bbs.32 using bits 14 to 23 142264 1.223 .8893 OPSO for bbs.32 using bits 13 to 22 142262 1.216 .8880 OPSO for bbs.32 using bits 12 to 21 142563 2.254 .9879 OPSO for bbs.32 using bits 11 to 20 142385 1.640 .9495 OPSO for bbs.32 using bits 10 to 19 142628 2.478 .9934 OPSO for bbs.32 using bits 9 to 18 141963 .185 .5734 OPSO for bbs.32 using bits 8 to 17 141258 -2.246 .0124 OPSO for bbs.32 using bits 7 to 16 141669 -.829 .2036 OPSO for bbs.32 using bits 6 to 15 142523 2.116 .9828 OPSO for bbs.32 using bits 5 to 14 141604 -1.053 .1462 OPSO for bbs.32 using bits 4 to 13 142241 1.144 .8736 OPSO for bbs.32 using bits 3 to 12 142272 1.251 .8945 OPSO for bbs.32 using bits 2 to 11 141756 -.529 .2985 OPSO for bbs.32 using bits 1 to 10 142041 .454 .6751 OQSO test for generator bbs.32 Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OQSO for bbs.32 using bits 28 to 32 142133 .758 .7758 OQSO for bbs.32 using bits 27 to 31 141422 -1.652 .0493 OQSO for bbs.32 using bits 26 to 30 142208 1.012 .8443 OQSO for bbs.32 using bits 25 to 29 141938 .097 .5387 OQSO for bbs.32 using bits 24 to 28 142494 1.982 .9763 OQSO for bbs.32 using bits 23 to 27 142183 .928 .8232 OQSO for bbs.32 using bits 22 to 26 142333 1.436 .9245 OQSO for bbs.32 using bits 21 to 25 141604 -1.035 .1503 OQSO for bbs.32 using bits 20 to 24 142343 1.470 .9292 OQSO for bbs.32 using bits 19 to 23 142550 2.172 .9851 OQSO for bbs.32 using bits 18 to 22 143346 4.870 1.0000 OQSO for bbs.32 using bits 17 to 21 148748 23.182 1.0000 OQSO for bbs.32 using bits 16 to 20 144574 9.033 1.0000 OQSO for bbs.32 using bits 15 to 19 142860 3.223 .9994 OQSO for bbs.32 using bits 14 to 18 142641 2.480 .9934 OQSO for bbs.32 using bits 13 to 17 142544 2.151 .9843 OQSO for bbs.32 using bits 12 to 16 142387 1.619 .9473 OQSO for bbs.32 using bits 11 to 15 142031 .412 .6600 OQSO for bbs.32 using bits 10 to 14 142235 1.104 .8652 OQSO for bbs.32 using bits 9 to 13 142663 2.555 .9947 OQSO for bbs.32 using bits 8 to 12 141960 .172 .5682 OQSO for bbs.32 using bits 7 to 11 141662 -.838 .2009 OQSO for bbs.32 using bits 6 to 10 141742 -.567 .2853 OQSO for bbs.32 using bits 5 to 9 142373 1.572 .9420 OQSO for bbs.32 using bits 4 to 8 141564 -1.171 .1209 OQSO for bbs.32 using bits 3 to 7 142394 1.643 .9498 OQSO for bbs.32 using bits 2 to 6 142159 .846 .8013 OQSO for bbs.32 using bits 1 to 5 141972 .212 .5841 DNA test for generator bbs.32 Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p DNA for bbs.32 using bits 31 to 32 141938 .085 .5337 DNA for bbs.32 using bits 30 to 31 141977 .200 .5791 DNA for bbs.32 using bits 29 to 30 142116 .610 .7290 DNA for bbs.32 using bits 28 to 29 142790 2.598 .9953 DNA for bbs.32 using bits 27 to 28 144084 6.415 1.0000 DNA for bbs.32 using bits 26 to 27 145779 11.415 1.0000 DNA for bbs.32 using bits 25 to 26 158902 50.126 1.0000 DNA for bbs.32 using bits 24 to 25 143162 3.695 .9999 DNA for bbs.32 using bits 23 to 24 141512 -1.172 .1206 DNA for bbs.32 using bits 22 to 23 141325 -1.724 .0424 DNA for bbs.32 using bits 21 to 22 141716 -.570 .2842 DNA for bbs.32 using bits 20 to 21 141804 -.311 .3780 DNA for bbs.32 using bits 19 to 20 142240 .975 .8353 DNA for bbs.32 using bits 18 to 19 142721 2.394 .9917 DNA for bbs.32 using bits 17 to 18 145810 11.506 1.0000 DNA for bbs.32 using bits 16 to 17 143094 3.495 .9998 DNA for bbs.32 using bits 15 to 16 141864 -.134 .4468 DNA for bbs.32 using bits 14 to 15 141241 -1.971 .0243 DNA for bbs.32 using bits 13 to 14 141594 -.930 .1761 DNA for bbs.32 using bits 12 to 13 142119 .619 .7319 DNA for bbs.32 using bits 11 to 12 141704 -.606 .2724 DNA for bbs.32 using bits 10 to 11 141651 -.762 .2230 DNA for bbs.32 using bits 9 to 10 142047 .406 .6577 DNA for bbs.32 using bits 8 to 9 142300 1.152 .8754 DNA for bbs.32 using bits 7 to 8 141887 -.066 .4737 DNA for bbs.32 using bits 6 to 7 141843 -.196 .4224 DNA for bbs.32 using bits 5 to 6 142044 .397 .6544 DNA for bbs.32 using bits 4 to 5 142007 .288 .6134 DNA for bbs.32 using bits 3 to 4 141490 -1.237 .1081 DNA for bbs.32 using bits 2 to 3 142088 .527 .7009 DNA for bbs.32 using bits 1 to 2 141773 -.402 .3438 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 bbs.32 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 bbs.32 11721.07 130.406 1.000000 byte stream for bbs.32 11562.52 128.163 1.000000 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 2480.08 -.282 .389061 bits 2 to 9 2494.39 -.079 .468357 bits 3 to 10 2493.67 -.090 .464323 bits 4 to 11 2510.60 .150 .559576 bits 5 to 12 2582.21 1.163 .877509 bits 6 to 13 2628.93 1.823 .965874 bits 7 to 14 2438.90 -.864 .193760 bits 8 to 15 2505.20 .074 .529303 bits 9 to 16 2513.73 .194 .576967 bits 10 to 17 2472.09 -.395 .346517 bits 11 to 18 2644.86 2.049 .979754 bits 12 to 19 2350.12 -2.120 .017019 bits 13 to 20 2513.53 .191 .575846 bits 14 to 21 2416.99 -1.174 .120222 bits 15 to 22 2571.57 1.012 .844268 bits 16 to 23 2593.63 1.324 .907267 bits 17 to 24 2592.24 1.304 .903961 bits 18 to 25 2540.56 .574 .716871 bits 19 to 26 2428.61 -1.010 .156333 bits 20 to 27 2560.91 .861 .805497 bits 21 to 28 2609.51 1.549 .939270 bits 22 to 29 2613.39 1.604 .945592 bits 23 to 30 2708.00 2.942 .998367 bits 24 to 31 2611.07 1.571 .941875 bits 25 to 32 2578.18 1.106 .865556 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 bbs.32 Of 12,000 tries, the average no. of successes should be 3523 with sigma=21.9 Successes: 3520 z-score: -.137 p-value: .445521 Successes: 3494 z-score: -1.324 p-value: .092718 Successes: 3511 z-score: -.548 p-value: .291865 Successes: 3528 z-score: .228 p-value: .590298 Successes: 3509 z-score: -.639 p-value: .261324 Successes: 3508 z-score: -.685 p-value: .246694 Successes: 3574 z-score: 2.329 p-value: .990064 Successes: 3499 z-score: -1.096 p-value: .136563 Successes: 3516 z-score: -.320 p-value: .374623 Successes: 3544 z-score: .959 p-value: .831196 square size avg. no. parked sample sigma 100. 3520.300 22.430 KSTEST for the above 10: p= .479080 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 bbs.32 Sample no. d^2 avg equiv uni 5 .2334 .9758 .209086 10 1.0235 1.2516 .642522 15 4.4559 1.3912 .988647 20 .2653 1.1487 .234079 25 .4216 1.0246 .345417 30 .4678 .9292 .375078 35 1.2789 .9846 .723448 40 .1031 .9471 .098441 45 .0478 .9194 .046890 50 .7415 .8702 .525368 55 1.0779 .8616 .661533 60 .5693 .8257 .435712 65 1.2151 .8584 .705121 70 1.3542 .8357 .743603 75 .5366 .8365 .416854 80 .1842 .8451 .168992 85 .1923 .8838 .175777 90 2.9142 .9198 .946541 95 .6723 .9009 .491204 100 .0786 .8861 .075969 MINIMUM DISTANCE TEST for bbs.32 Result of KS test on 20 transformed mindist^2's: p-value= .800097 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 bbs.32 sample no: 1 r^3= 15.442 p-value= .40235 sample no: 2 r^3= 32.790 p-value= .66479 sample no: 3 r^3= 35.031 p-value= .68892 sample no: 4 r^3= 62.943 p-value= .87731 sample no: 5 r^3= 22.871 p-value= .53344 sample no: 6 r^3= 19.776 p-value= .48273 sample no: 7 r^3= 28.503 p-value= .61329 sample no: 8 r^3= 10.241 p-value= .28920 sample no: 9 r^3= 17.346 p-value= .43910 sample no: 10 r^3= 39.290 p-value= .73009 sample no: 11 r^3= 21.135 p-value= .50564 sample no: 12 r^3= 1.263 p-value= .04123 sample no: 13 r^3= .095 p-value= .00316 sample no: 14 r^3= 33.559 p-value= .67328 sample no: 15 r^3= 38.901 p-value= .72656 sample no: 16 r^3= 76.679 p-value= .92238 sample no: 17 r^3= 29.361 p-value= .62420 sample no: 18 r^3= 5.619 p-value= .17082 sample no: 19 r^3= 36.511 p-value= .70390 sample no: 20 r^3= 12.862 p-value= .34866 A KS test is applied to those 20 p-values. --------------------------------------------------------- 3DSPHERES test for file bbs.32 p-value= .542105 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 bbs.32 Table of standardized frequency counts ( (obs-exp)/sqrt(exp) )^2 for j taking values <=6,7,8,...,47,>=48: -.1 .5 -1.3 -.3 -.5 -1.4 .4 -1.0 -1.1 2.8 -.1 .1 .8 .8 .8 -1.6 -.1 -.3 .7 -.7 .5 1.4 -1.1 -.4 -.3 -2.1 -.4 .2 -1.7 1.9 .5 .6 .9 .8 .8 .4 -1.6 -1.3 -1.2 -1.3 -.6 .0 -.1 Chi-square with 42 degrees of freedom: 45.192 z-score= .348 p-value= .660027 ______________________________________________________________ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 .072524 Test no. 2 p-value .471695 Test no. 3 p-value .070680 Test no. 4 p-value .418355 Test no. 5 p-value .512679 Test no. 6 p-value .030221 Test no. 7 p-value .357225 Test no. 8 p-value .948149 Test no. 9 p-value .934337 Test no. 10 p-value .081823 Results of the OSUM test for bbs.32 KSTEST on the above 10 p-values: .843613 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 bbs.32 Up and down runs in a sample of 10000 _________________________________________________ Run test for bbs.32 : runs up; ks test for 10 p's: .114778 runs down; ks test for 10 p's: .573391 Run test for bbs.32 : runs up; ks test for 10 p's: .210312 runs down; ks test for 10 p's: .944975 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 bbs.32 No. of wins: Observed Expected 98687 98585.86 98687= No. of wins, z-score= .452 pvalue= .67450 Analysis of Throws-per-Game: Chisq= 17.55 for 20 degrees of freedom, p= .38328 Throws Observed Expected Chisq Sum 1 66879 66666.7 .676 .676 2 37450 37654.3 1.109 1.785 3 26928 26954.7 .027 1.811 4 19281 19313.5 .055 1.866 5 13886 13851.4 .086 1.952 6 9924 9943.5 .038 1.991 7 7137 7145.0 .009 2.000 8 5170 5139.1 .186 2.186 9 3690 3699.9 .026 2.212 10 2731 2666.3 1.570 3.782 11 1896 1923.3 .388 4.171 12 1379 1388.7 .068 4.239 13 951 1003.7 2.769 7.008 14 718 726.1 .091 7.099 15 553 525.8 1.403 8.502 16 416 381.2 3.186 11.689 17 244 276.5 3.829 15.517 18 204 200.8 .050 15.567 19 146 146.0 .000 15.567 20 106 106.2 .000 15.568 21 311 287.1 1.987 17.555 SUMMARY FOR bbs.32 p-value for no. of wins: .674495 p-value for throws/game: .383281 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Results of DIEHARD battery of tests sent to file bbs.out4