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 2.046 duplicate number number spacings observed expected 0 63. 67.668 1 131. 135.335 2 142. 135.335 3 93. 90.224 4 41. 45.112 5 19. 18.045 6 to INF 11. 8.282 Chisquare with 6 d.o.f. = 2.19 p-value= .098778 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean bbs.32 using bits 2 to 25 1.968 duplicate number number spacings observed expected 0 75. 67.668 1 132. 135.335 2 134. 135.335 3 91. 90.224 4 40. 45.112 5 19. 18.045 6 to INF 9. 8.282 Chisquare with 6 d.o.f. = 1.59 p-value= .046611 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean bbs.32 using bits 3 to 26 1.940 duplicate number number spacings observed expected 0 76. 67.668 1 142. 135.335 2 121. 135.335 3 91. 90.224 4 46. 45.112 5 17. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 3.16 p-value= .210937 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean bbs.32 using bits 4 to 27 2.058 duplicate number number spacings observed expected 0 64. 67.668 1 138. 135.335 2 131. 135.335 3 89. 90.224 4 47. 45.112 5 18. 18.045 6 to INF 13. 8.282 Chisquare with 6 d.o.f. = 3.17 p-value= .213268 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean bbs.32 using bits 5 to 28 1.916 duplicate number number spacings observed expected 0 68. 67.668 1 154. 135.335 2 118. 135.335 3 96. 90.224 4 47. 45.112 5 13. 18.045 6 to INF 4. 8.282 Chisquare with 6 d.o.f. = 8.87 p-value= .818933 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean bbs.32 using bits 6 to 29 1.958 duplicate number number spacings observed expected 0 61. 67.668 1 157. 135.335 2 125. 135.335 3 89. 90.224 4 47. 45.112 5 13. 18.045 6 to INF 8. 8.282 Chisquare with 6 d.o.f. = 6.43 p-value= .623214 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean bbs.32 using bits 7 to 30 2.094 duplicate number number spacings observed expected 0 56. 67.668 1 123. 135.335 2 149. 135.335 3 93. 90.224 4 54. 45.112 5 21. 18.045 6 to INF 4. 8.282 Chisquare with 6 d.o.f. = 9.05 p-value= .829229 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean bbs.32 using bits 8 to 31 2.030 duplicate number number spacings observed expected 0 63. 67.668 1 118. 135.335 2 154. 135.335 3 96. 90.224 4 48. 45.112 5 17. 18.045 6 to INF 4. 8.282 Chisquare with 6 d.o.f. = 7.95 p-value= .757884 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean bbs.32 using bits 9 to 32 1.986 duplicate number number spacings observed expected 0 61. 67.668 1 137. 135.335 2 142. 135.335 3 94. 90.224 4 48. 45.112 5 12. 18.045 6 to INF 6. 8.282 Chisquare with 6 d.o.f. = 4.00 p-value= .323627 ::::::::::::::::::::::::::::::::::::::::: The 9 p-values were .098778 .046611 .210937 .213268 .818933 .623214 .829229 .757884 .323627 A KSTEST for the 9 p-values yields .327992 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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=147.002; p-value= .998737 OPERM5 test for file bbs.32 For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=187.354; p-value=1.000000 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 202 211.4 .419543 .420 29 5163 5134.0 .163694 .583 30 23139 23103.0 .055951 .639 31 11496 11551.5 .266888 .906 chisquare= .906 for 3 d. of f.; p-value= .346618 -------------------------------------------------------------- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 183 211.4 3.819843 3.820 30 5130 5134.0 .003132 3.823 31 23198 23103.0 .390256 4.213 32 11489 11551.5 .338423 4.552 chisquare= 4.552 for 3 d. of f.; p-value= .808715 -------------------------------------------------------------- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 935 944.3 .092 .092 r =5 21662 21743.9 .308 .400 r =6 77403 77311.8 .108 .508 p=1-exp(-SUM/2)= .22418 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 949 944.3 .023 .023 r =5 21585 21743.9 1.161 1.185 r =6 77466 77311.8 .308 1.492 p=1-exp(-SUM/2)= .52577 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 939 944.3 .030 .030 r =5 21377 21743.9 6.191 6.221 r =6 77684 77311.8 1.792 8.013 p=1-exp(-SUM/2)= .98180 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 907 944.3 1.473 1.473 r =5 21674 21743.9 .225 1.698 r =6 77419 77311.8 .149 1.847 p=1-exp(-SUM/2)= .60283 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 979 944.3 1.275 1.275 r =5 21642 21743.9 .478 1.753 r =6 77379 77311.8 .058 1.811 p=1-exp(-SUM/2)= .59565 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 983 944.3 1.586 1.586 r =5 21618 21743.9 .729 2.315 r =6 77399 77311.8 .098 2.413 p=1-exp(-SUM/2)= .70079 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 922 944.3 .527 .527 r =5 21705 21743.9 .070 .596 r =6 77373 77311.8 .048 .645 p=1-exp(-SUM/2)= .27556 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 977 944.3 1.132 1.132 r =5 21588 21743.9 1.118 2.250 r =6 77435 77311.8 .196 2.446 p=1-exp(-SUM/2)= .70571 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 920 944.3 .625 .625 r =5 21831 21743.9 .349 .974 r =6 77249 77311.8 .051 1.025 p=1-exp(-SUM/2)= .40109 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 932 944.3 .160 .160 r =5 21629 21743.9 .607 .767 r =6 77439 77311.8 .209 .977 p=1-exp(-SUM/2)= .38635 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 916 944.3 .848 .848 r =5 21551 21743.9 1.711 2.560 r =6 77533 77311.8 .633 3.192 p=1-exp(-SUM/2)= .79733 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 945 944.3 .001 .001 r =5 21599 21743.9 .966 .966 r =6 77456 77311.8 .269 1.235 p=1-exp(-SUM/2)= .46073 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 947 944.3 .008 .008 r =5 21622 21743.9 .683 .691 r =6 77431 77311.8 .184 .875 p=1-exp(-SUM/2)= .35431 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 962 944.3 .332 .332 r =5 21542 21743.9 1.875 2.206 r =6 77496 77311.8 .439 2.645 p=1-exp(-SUM/2)= .73357 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 935 944.3 .092 .092 r =5 21585 21743.9 1.161 1.253 r =6 77480 77311.8 .366 1.619 p=1-exp(-SUM/2)= .55486 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 925 944.3 .395 .395 r =5 21541 21743.9 1.893 2.288 r =6 77534 77311.8 .639 2.926 p=1-exp(-SUM/2)= .76851 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 916 944.3 .848 .848 r =5 21639 21743.9 .506 1.354 r =6 77445 77311.8 .229 1.584 p=1-exp(-SUM/2)= .54701 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 980 944.3 1.350 1.350 r =5 21584 21743.9 1.176 2.525 r =6 77436 77311.8 .200 2.725 p=1-exp(-SUM/2)= .74397 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 920 944.3 .625 .625 r =5 21666 21743.9 .279 .904 r =6 77414 77311.8 .135 1.040 p=1-exp(-SUM/2)= .40535 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 964 944.3 .411 .411 r =5 21529 21743.9 2.124 2.535 r =6 77507 77311.8 .493 3.028 p=1-exp(-SUM/2)= .77994 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 976 944.3 1.064 1.064 r =5 21359 21743.9 6.813 7.877 r =6 77665 77311.8 1.614 9.491 p=1-exp(-SUM/2)= .99131 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 976 944.3 1.064 1.064 r =5 21665 21743.9 .286 1.350 r =6 77359 77311.8 .029 1.379 p=1-exp(-SUM/2)= .49822 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 945 944.3 .001 .001 r =5 21659 21743.9 .331 .332 r =6 77396 77311.8 .092 .424 p=1-exp(-SUM/2)= .19092 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 929 944.3 .248 .248 r =5 21739 21743.9 .001 .249 r =6 77332 77311.8 .005 .254 p=1-exp(-SUM/2)= .11941 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 930 944.3 .217 .217 r =5 21860 21743.9 .620 .836 r =6 77210 77311.8 .134 .971 p=1-exp(-SUM/2)= .38447 TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices These should be 25 uniform [0,1] random variables: .224182 .525771 .981799 .602832 .595654 .700795 .275561 .705708 .401094 .386354 .797332 .460727 .354312 .733570 .554863 .768511 .547007 .743974 .405349 .779935 .991309 .498220 .190917 .119407 .384472 brank test summary for bbs.32 The KS test for those 25 supposed UNI's yields KS p-value= .745974 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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: 143655 missing words, 4.08 sigmas from mean, p-value= .99998 tst no 2: 143492 missing words, 3.70 sigmas from mean, p-value= .99989 tst no 3: 143648 missing words, 4.06 sigmas from mean, p-value= .99998 tst no 4: 143430 missing words, 3.55 sigmas from mean, p-value= .99981 tst no 5: 144164 missing words, 5.27 sigmas from mean, p-value=1.00000 tst no 6: 143382 missing words, 3.44 sigmas from mean, p-value= .99971 tst no 7: 143469 missing words, 3.64 sigmas from mean, p-value= .99987 tst no 8: 143690 missing words, 4.16 sigmas from mean, p-value= .99998 tst no 9: 143449 missing words, 3.60 sigmas from mean, p-value= .99984 tst no 10: 144108 missing words, 5.14 sigmas from mean, p-value=1.00000 tst no 11: 143443 missing words, 3.58 sigmas from mean, p-value= .99983 tst no 12: 143521 missing words, 3.77 sigmas from mean, p-value= .99992 tst no 13: 143785 missing words, 4.38 sigmas from mean, p-value= .99999 tst no 14: 143482 missing words, 3.67 sigmas from mean, p-value= .99988 tst no 15: 144113 missing words, 5.15 sigmas from mean, p-value=1.00000 tst no 16: 143448 missing words, 3.60 sigmas from mean, p-value= .99984 tst no 17: 143471 missing words, 3.65 sigmas from mean, p-value= .99987 tst no 18: 143875 missing words, 4.59 sigmas from mean, p-value=1.00000 tst no 19: 143541 missing words, 3.81 sigmas from mean, p-value= .99993 tst no 20: 144047 missing words, 4.99 sigmas from mean, p-value=1.00000 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 556044******* 1.0000 OPSO for bbs.32 using bits 22 to 31 556021******* 1.0000 OPSO for bbs.32 using bits 21 to 30 556191******* 1.0000 OPSO for bbs.32 using bits 20 to 29 556130******* 1.0000 OPSO for bbs.32 using bits 19 to 28 556033******* 1.0000 OPSO for bbs.32 using bits 18 to 27 556680******* 1.0000 OPSO for bbs.32 using bits 17 to 26 556939******* 1.0000 OPSO for bbs.32 using bits 16 to 25 555897******* 1.0000 OPSO for bbs.32 using bits 15 to 24 556034******* 1.0000 OPSO for bbs.32 using bits 14 to 23 556063******* 1.0000 OPSO for bbs.32 using bits 13 to 22 556181******* 1.0000 OPSO for bbs.32 using bits 12 to 21 556088******* 1.0000 OPSO for bbs.32 using bits 11 to 20 555978******* 1.0000 OPSO for bbs.32 using bits 10 to 19 556623******* 1.0000 OPSO for bbs.32 using bits 9 to 18 557106******* 1.0000 OPSO for bbs.32 using bits 8 to 17 556027******* 1.0000 OPSO for bbs.32 using bits 7 to 16 556000******* 1.0000 OPSO for bbs.32 using bits 6 to 15 556117******* 1.0000 OPSO for bbs.32 using bits 5 to 14 556231******* 1.0000 OPSO for bbs.32 using bits 4 to 13 556157******* 1.0000 OPSO for bbs.32 using bits 3 to 12 555983******* 1.0000 OPSO for bbs.32 using bits 2 to 11 556656******* 1.0000 OPSO for bbs.32 using bits 1 to 10 557002******* 1.0000 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 554451******* 1.0000 OQSO for bbs.32 using bits 27 to 31 554657******* 1.0000 OQSO for bbs.32 using bits 26 to 30 554543******* 1.0000 OQSO for bbs.32 using bits 25 to 29 554300******* 1.0000 OQSO for bbs.32 using bits 24 to 28 554419******* 1.0000 OQSO for bbs.32 using bits 23 to 27 554326******* 1.0000 OQSO for bbs.32 using bits 22 to 26 554390******* 1.0000 OQSO for bbs.32 using bits 21 to 25 554629******* 1.0000 OQSO for bbs.32 using bits 20 to 24 554508******* 1.0000 OQSO for bbs.32 using bits 19 to 23 554570******* 1.0000 OQSO for bbs.32 using bits 18 to 22 554574******* 1.0000 OQSO for bbs.32 using bits 17 to 21 554179******* 1.0000 OQSO for bbs.32 using bits 16 to 20 554394******* 1.0000 OQSO for bbs.32 using bits 15 to 19 554367******* 1.0000 OQSO for bbs.32 using bits 14 to 18 554465******* 1.0000 OQSO for bbs.32 using bits 13 to 17 554580******* 1.0000 OQSO for bbs.32 using bits 12 to 16 554406******* 1.0000 OQSO for bbs.32 using bits 11 to 15 554556******* 1.0000 OQSO for bbs.32 using bits 10 to 14 554551******* 1.0000 OQSO for bbs.32 using bits 9 to 13 554235******* 1.0000 OQSO for bbs.32 using bits 8 to 12 554477******* 1.0000 OQSO for bbs.32 using bits 7 to 11 554273******* 1.0000 OQSO for bbs.32 using bits 6 to 10 554595******* 1.0000 OQSO for bbs.32 using bits 5 to 9 554624******* 1.0000 OQSO for bbs.32 using bits 4 to 8 554468******* 1.0000 OQSO for bbs.32 using bits 3 to 7 554684******* 1.0000 OQSO for bbs.32 using bits 2 to 6 554602******* 1.0000 OQSO for bbs.32 using bits 1 to 5 554299******* 1.0000 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 553983******* 1.0000 DNA for bbs.32 using bits 30 to 31 554454******* 1.0000 DNA for bbs.32 using bits 29 to 30 554507******* 1.0000 DNA for bbs.32 using bits 28 to 29 554595******* 1.0000 DNA for bbs.32 using bits 27 to 28 553789******* 1.0000 DNA for bbs.32 using bits 26 to 27 554648******* 1.0000 DNA for bbs.32 using bits 25 to 26 554889******* 1.0000 DNA for bbs.32 using bits 24 to 25 554417******* 1.0000 DNA for bbs.32 using bits 23 to 24 553857******* 1.0000 DNA for bbs.32 using bits 22 to 23 554470******* 1.0000 DNA for bbs.32 using bits 21 to 22 554379******* 1.0000 DNA for bbs.32 using bits 20 to 21 554478******* 1.0000 DNA for bbs.32 using bits 19 to 20 553947******* 1.0000 DNA for bbs.32 using bits 18 to 19 554751******* 1.0000 DNA for bbs.32 using bits 17 to 18 554720******* 1.0000 DNA for bbs.32 using bits 16 to 17 554601******* 1.0000 DNA for bbs.32 using bits 15 to 16 553971******* 1.0000 DNA for bbs.32 using bits 14 to 15 554489******* 1.0000 DNA for bbs.32 using bits 13 to 14 554487******* 1.0000 DNA for bbs.32 using bits 12 to 13 554490******* 1.0000 DNA for bbs.32 using bits 11 to 12 553876******* 1.0000 DNA for bbs.32 using bits 10 to 11 554751******* 1.0000 DNA for bbs.32 using bits 9 to 10 554617******* 1.0000 DNA for bbs.32 using bits 8 to 9 554448******* 1.0000 DNA for bbs.32 using bits 7 to 8 554003******* 1.0000 DNA for bbs.32 using bits 6 to 7 554534******* 1.0000 DNA for bbs.32 using bits 5 to 6 554456******* 1.0000 DNA for bbs.32 using bits 4 to 5 554431******* 1.0000 DNA for bbs.32 using bits 3 to 4 553940******* 1.0000 DNA for bbs.32 using bits 2 to 3 554672******* 1.0000 DNA for bbs.32 using bits 1 to 2 554748******* 1.0000 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 10844.84 118.014 1.000000 byte stream for bbs.32 11197.53 123.002 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 2502.96 .042 .516674 bits 2 to 9 2431.26 -.972 .165510 bits 3 to 10 2638.48 1.958 .974911 bits 4 to 11 2446.33 -.759 .223936 bits 5 to 12 2619.88 1.695 .954994 bits 6 to 13 2487.37 -.179 .429143 bits 7 to 14 2495.13 -.069 .472543 bits 8 to 15 2493.78 -.088 .464977 bits 9 to 16 2477.33 -.321 .374258 bits 10 to 17 2584.70 1.198 .884515 bits 11 to 18 2638.29 1.956 .974750 bits 12 to 19 2493.99 -.085 .466143 bits 13 to 20 2539.12 .553 .709964 bits 14 to 21 2433.14 -.946 .172180 bits 15 to 22 2488.89 -.157 .437574 bits 16 to 23 2612.95 1.597 .944906 bits 17 to 24 2509.74 .138 .554775 bits 18 to 25 2529.68 .420 .662638 bits 19 to 26 2452.17 -.676 .249398 bits 20 to 27 2404.22 -1.355 .087774 bits 21 to 28 2411.41 -1.253 .105123 bits 22 to 29 2480.67 -.273 .392258 bits 23 to 30 2506.54 .093 .536866 bits 24 to 31 2519.82 .280 .610355 bits 25 to 32 2507.45 .105 .541979 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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: 3506 z-score: -.776 p-value: .218799 Successes: 3541 z-score: .822 p-value: .794438 Successes: 3535 z-score: .548 p-value: .708135 Successes: 3480 z-score: -1.963 p-value: .024796 Successes: 3547 z-score: 1.096 p-value: .863437 Successes: 3476 z-score: -2.146 p-value: .015932 Successes: 3548 z-score: 1.142 p-value: .873180 Successes: 3540 z-score: .776 p-value: .781201 Successes: 3551 z-score: 1.279 p-value: .899470 Successes: 3524 z-score: .046 p-value: .518210 square size avg. no. parked sample sigma 100. 3524.800 26.551 KSTEST for the above 10: p= .781492 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 1.5626 .8398 .792047 10 1.5134 1.1995 .781510 15 .7072 1.0606 .508735 20 .0317 .8967 .031319 25 .9343 .9578 .608993 30 .2187 .8499 .197353 35 1.1373 .8655 .681157 40 .2205 .8226 .198787 45 1.4047 .8169 .756292 50 .3830 .7987 .319490 55 .1387 .7652 .130142 60 1.1169 .7551 .674540 65 .3054 .7424 .264329 70 2.8579 .7551 .943431 75 2.7509 .7713 .937006 80 2.8622 .8273 .943674 85 .4990 .8110 .394369 90 3.6190 .8614 .973672 95 .1502 .8747 .140152 100 .9247 .8628 .605176 MINIMUM DISTANCE TEST for bbs.32 Result of KS test on 20 transformed mindist^2's: p-value= .495479 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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= 6.376 p-value= .19147 sample no: 2 r^3= 16.483 p-value= .42272 sample no: 3 r^3= 57.796 p-value= .85435 sample no: 4 r^3= 15.579 p-value= .40506 sample no: 5 r^3= 214.059 p-value= .99920 sample no: 6 r^3= 23.327 p-value= .54047 sample no: 7 r^3= 2.732 p-value= .08703 sample no: 8 r^3= 34.392 p-value= .68222 sample no: 9 r^3= 19.009 p-value= .46935 sample no: 10 r^3= 71.366 p-value= .90735 sample no: 11 r^3= 20.297 p-value= .49165 sample no: 12 r^3= 22.199 p-value= .52287 sample no: 13 r^3= 83.751 p-value= .93868 sample no: 14 r^3= 22.177 p-value= .52252 sample no: 15 r^3= 51.553 p-value= .82065 sample no: 16 r^3= 45.434 p-value= .78008 sample no: 17 r^3= 11.800 p-value= .32520 sample no: 18 r^3= 61.038 p-value= .86927 sample no: 19 r^3= 28.374 p-value= .61163 sample no: 20 r^3= 14.798 p-value= .38936 A KS test is applied to those 20 p-values. --------------------------------------------------------- 3DSPHERES test for file bbs.32 p-value= .801257 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 .5 -2.8 -2.4 -4.3 .1 .5 -.5 1.1 -2.1 3.0 -1.1 -3.2 -1.5 -1.1 -1.4 -2.1 -.2 1.4 1.6 -1.8 4.8 3.0 1.7 1.8 -1.9 .2 -.2 .5 .0 -1.6 .4 2.1 1.4 -2.6 .1 2.1 5.5 3.0 -1.8 .9 -1.0 -1.1 Chi-square with 42 degrees of freedom:186.535 z-score= 15.770 p-value=1.000000 ______________________________________________________________ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 .208261 Test no. 2 p-value .389122 Test no. 3 p-value .823191 Test no. 4 p-value .427107 Test no. 5 p-value .164340 Test no. 6 p-value .077852 Test no. 7 p-value .715234 Test no. 8 p-value .820594 Test no. 9 p-value .269488 Test no. 10 p-value .856772 Results of the OSUM test for bbs.32 KSTEST on the above 10 p-values: .108177 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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: .894457 runs down; ks test for 10 p's: .668952 Run test for bbs.32 : runs up; ks test for 10 p's: .394742 runs down; ks test for 10 p's: .231693 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 98508 98585.86 98508= No. of wins, z-score= -.348 pvalue= .36383 Analysis of Throws-per-Game: Chisq= 13.37 for 20 degrees of freedom, p= .13905 Throws Observed Expected Chisq Sum 1 66442 66666.7 .757 .757 2 37808 37654.3 .627 1.384 3 26863 26954.7 .312 1.697 4 19321 19313.5 .003 1.699 5 13927 13851.4 .412 2.112 6 10140 9943.5 3.881 5.993 7 7050 7145.0 1.264 7.257 8 5109 5139.1 .176 7.433 9 3768 3699.9 1.255 8.688 10 2630 2666.3 .494 9.182 11 1905 1923.3 .175 9.357 12 1399 1388.7 .076 9.432 13 1012 1003.7 .068 9.501 14 743 726.1 .391 9.892 15 512 525.8 .364 10.256 16 352 381.2 2.229 12.486 17 283 276.5 .151 12.637 18 205 200.8 .087 12.723 19 147 146.0 .007 12.730 20 98 106.2 .635 13.366 21 286 287.1 .004 13.370 SUMMARY FOR bbs.32 p-value for no. of wins: .363833 p-value for throws/game: .139054 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Results of DIEHARD battery of tests sent to file bbs.out2