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 SG100.DAT For a sample of size 500: mean SG100.DAT using bits 1 to 24 2.164 duplicate number number spacings observed expected 0 53. 67.668 1 121. 135.335 2 151. 135.335 3 86. 90.224 4 55. 45.112 5 24. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = 11.20 p-value= .917554 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean SG100.DAT using bits 2 to 25 2.012 duplicate number number spacings observed expected 0 65. 67.668 1 129. 135.335 2 143. 135.335 3 91. 90.224 4 50. 45.112 5 16. 18.045 6 to INF 6. 8.282 Chisquare with 6 d.o.f. = 2.23 p-value= .102885 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean SG100.DAT using bits 3 to 26 1.998 duplicate number number spacings observed expected 0 69. 67.668 1 133. 135.335 2 133. 135.335 3 99. 90.224 4 39. 45.112 5 18. 18.045 6 to INF 9. 8.282 Chisquare with 6 d.o.f. = 1.85 p-value= .067118 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean SG100.DAT using bits 4 to 27 1.996 duplicate number number spacings observed expected 0 63. 67.668 1 131. 135.335 2 146. 135.335 3 93. 90.224 4 48. 45.112 5 12. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 3.79 p-value= .295589 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean SG100.DAT using bits 5 to 28 1.912 duplicate number number spacings observed expected 0 76. 67.668 1 138. 135.335 2 132. 135.335 3 93. 90.224 4 39. 45.112 5 15. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 2.79 p-value= .164846 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean SG100.DAT using bits 6 to 29 1.942 duplicate number number spacings observed expected 0 70. 67.668 1 142. 135.335 2 139. 135.335 3 86. 90.224 4 36. 45.112 5 18. 18.045 6 to INF 9. 8.282 Chisquare with 6 d.o.f. = 2.61 p-value= .143850 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean SG100.DAT using bits 7 to 30 1.954 duplicate number number spacings observed expected 0 78. 67.668 1 127. 135.335 2 140. 135.335 3 79. 90.224 4 52. 45.112 5 19. 18.045 6 to INF 5. 8.282 Chisquare with 6 d.o.f. = 6.05 p-value= .582480 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean SG100.DAT using bits 8 to 31 1.886 duplicate number number spacings observed expected 0 83. 67.668 1 138. 135.335 2 138. 135.335 3 68. 90.224 4 50. 45.112 5 15. 18.045 6 to INF 8. 8.282 Chisquare with 6 d.o.f. = 10.11 p-value= .879742 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean SG100.DAT using bits 9 to 32 2.028 duplicate number number spacings observed expected 0 62. 67.668 1 137. 135.335 2 143. 135.335 3 81. 90.224 4 48. 45.112 5 19. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = 2.46 p-value= .127542 ::::::::::::::::::::::::::::::::::::::::: The 9 p-values were .917554 .102885 .067118 .295589 .164846 .143850 .582480 .879742 .127542 A KSTEST for the 9 p-values yields .878397 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 SG100.DAT For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=101.603; p-value= .591239 OPERM5 test for file SG100.DAT For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=105.512; p-value= .691597 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 SG100.DAT 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 229 211.4 1.462156 1.462 29 5116 5134.0 .063180 1.525 30 23100 23103.0 .000402 1.526 31 11555 11551.5 .001046 1.527 chisquare= 1.527 for 3 d. of f.; p-value= .432196 -------------------------------------------------------------- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 SG100.DAT 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 5211 5134.0 1.154540 1.771 31 22819 23103.0 3.492294 5.263 32 11770 11551.5 4.132059 9.396 chisquare= 9.396 for 3 d. of f.; p-value= .976619 -------------------------------------------------------------- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 SG100.DAT Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 1 to 8 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 899 944.3 2.173 2.173 r =5 21504 21743.9 2.647 4.820 r =6 77597 77311.8 1.052 5.872 p=1-exp(-SUM/2)= .94693 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 2 to 9 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 916 944.3 .848 .848 r =5 21545 21743.9 1.819 2.668 r =6 77539 77311.8 .668 3.335 p=1-exp(-SUM/2)= .81131 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 3 to 10 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 969 944.3 .646 .646 r =5 21433 21743.9 4.445 5.091 r =6 77598 77311.8 1.059 6.151 p=1-exp(-SUM/2)= .95383 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 4 to 11 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 933 944.3 .135 .135 r =5 21743 21743.9 .000 .135 r =6 77324 77311.8 .002 .137 p=1-exp(-SUM/2)= .06631 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 5 to 12 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 988 944.3 2.022 2.022 r =5 21677 21743.9 .206 2.228 r =6 77335 77311.8 .007 2.235 p=1-exp(-SUM/2)= .67290 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 6 to 13 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 958 944.3 .199 .199 r =5 21573 21743.9 1.343 1.542 r =6 77469 77311.8 .320 1.862 p=1-exp(-SUM/2)= .60576 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 7 to 14 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 931 944.3 .187 .187 r =5 21732 21743.9 .007 .194 r =6 77337 77311.8 .008 .202 p=1-exp(-SUM/2)= .09610 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 8 to 15 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 948 944.3 .014 .014 r =5 21946 21743.9 1.878 1.893 r =6 77106 77311.8 .548 2.441 p=1-exp(-SUM/2)= .70488 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 9 to 16 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 945 944.3 .001 .001 r =5 21729 21743.9 .010 .011 r =6 77326 77311.8 .003 .013 p=1-exp(-SUM/2)= .00664 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 10 to 17 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 899 944.3 2.173 2.173 r =5 21656 21743.9 .355 2.529 r =6 77445 77311.8 .229 2.758 p=1-exp(-SUM/2)= .74818 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 11 to 18 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 905 944.3 1.636 1.636 r =5 21747 21743.9 .000 1.636 r =6 77348 77311.8 .017 1.653 p=1-exp(-SUM/2)= .56244 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 12 to 19 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 941 944.3 .012 .012 r =5 21834 21743.9 .373 .385 r =6 77225 77311.8 .097 .482 p=1-exp(-SUM/2)= .21429 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 13 to 20 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 930 944.3 .217 .217 r =5 21780 21743.9 .060 .277 r =6 77290 77311.8 .006 .283 p=1-exp(-SUM/2)= .13180 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 14 to 21 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 915 944.3 .909 .909 r =5 21836 21743.9 .390 1.299 r =6 77249 77311.8 .051 1.350 p=1-exp(-SUM/2)= .49093 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 15 to 22 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 931 944.3 .187 .187 r =5 21872 21743.9 .755 .942 r =6 77197 77311.8 .170 1.113 p=1-exp(-SUM/2)= .42665 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 16 to 23 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 942 944.3 .006 .006 r =5 21776 21743.9 .047 .053 r =6 77282 77311.8 .011 .064 p=1-exp(-SUM/2)= .03173 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 17 to 24 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 993 944.3 2.511 2.511 r =5 21686 21743.9 .154 2.666 r =6 77321 77311.8 .001 2.667 p=1-exp(-SUM/2)= .73641 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 18 to 25 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 960 944.3 .261 .261 r =5 21597 21743.9 .992 1.253 r =6 77443 77311.8 .223 1.476 p=1-exp(-SUM/2)= .52195 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 19 to 26 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 952 944.3 .063 .063 r =5 21893 21743.9 1.022 1.085 r =6 77155 77311.8 .318 1.403 p=1-exp(-SUM/2)= .50421 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 20 to 27 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 959 944.3 .229 .229 r =5 21661 21743.9 .316 .545 r =6 77380 77311.8 .060 .605 p=1-exp(-SUM/2)= .26104 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 21 to 28 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 911 944.3 1.174 1.174 r =5 21646 21743.9 .441 1.615 r =6 77443 77311.8 .223 1.838 p=1-exp(-SUM/2)= .60104 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 22 to 29 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 941 944.3 .012 .012 r =5 21645 21743.9 .450 .461 r =6 77414 77311.8 .135 .596 p=1-exp(-SUM/2)= .25787 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 23 to 30 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 968 944.3 .595 .595 r =5 21827 21743.9 .318 .912 r =6 77205 77311.8 .148 1.060 p=1-exp(-SUM/2)= .41136 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 24 to 31 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 964 944.3 .411 .411 r =5 21643 21743.9 .468 .879 r =6 77393 77311.8 .085 .964 p=1-exp(-SUM/2)= .38258 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG SG100.DAT b-rank test for bits 25 to 32 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 954 944.3 .100 .100 r =5 21674 21743.9 .225 .324 r =6 77372 77311.8 .047 .371 p=1-exp(-SUM/2)= .16939 TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices These should be 25 uniform [0,1] random variables: .946926 .811309 .953829 .066306 .672905 .605756 .096105 .704883 .006645 .748178 .562440 .214295 .131803 .490927 .426648 .031729 .736410 .521948 .504205 .261037 .601044 .257873 .411363 .382583 .169391 brank test summary for SG100.DAT The KS test for those 25 supposed UNI's yields KS p-value= .286560 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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: 142407 missing words, 1.16 sigmas from mean, p-value= .87754 tst no 2: 141541 missing words, -.86 sigmas from mean, p-value= .19473 tst no 3: 141911 missing words, .00 sigmas from mean, p-value= .50156 tst no 4: 141300 missing words, -1.42 sigmas from mean, p-value= .07727 tst no 5: 142023 missing words, .27 sigmas from mean, p-value= .60472 tst no 6: 141841 missing words, -.16 sigmas from mean, p-value= .43658 tst no 7: 142325 missing words, .97 sigmas from mean, p-value= .83427 tst no 8: 141689 missing words, -.51 sigmas from mean, p-value= .30335 tst no 9: 142087 missing words, .42 sigmas from mean, p-value= .66097 tst no 10: 142340 missing words, 1.01 sigmas from mean, p-value= .84285 tst no 11: 141340 missing words, -1.33 sigmas from mean, p-value= .09173 tst no 12: 142234 missing words, .76 sigmas from mean, p-value= .77595 tst no 13: 141629 missing words, -.65 sigmas from mean, p-value= .25624 tst no 14: 141704 missing words, -.48 sigmas from mean, p-value= .31571 tst no 15: 141934 missing words, .06 sigmas from mean, p-value= .52298 tst no 16: 142176 missing words, .62 sigmas from mean, p-value= .73338 tst no 17: 142170 missing words, .61 sigmas from mean, p-value= .72875 tst no 18: 141332 missing words, -1.35 sigmas from mean, p-value= .08868 tst no 19: 142431 missing words, 1.22 sigmas from mean, p-value= .88855 tst no 20: 141749 missing words, -.37 sigmas from mean, p-value= .35398 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 SG100.DAT Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OPSO for SG100.DAT using bits 23 to 32 142035 .433 .6676 OPSO for SG100.DAT using bits 22 to 31 142206 1.023 .8468 OPSO for SG100.DAT using bits 21 to 30 142083 .599 .7254 OPSO for SG100.DAT using bits 20 to 29 141822 -.301 .3817 OPSO for SG100.DAT using bits 19 to 28 142119 .723 .7652 OPSO for SG100.DAT using bits 18 to 27 141808 -.349 .3634 OPSO for SG100.DAT using bits 17 to 26 142236 1.126 .8700 OPSO for SG100.DAT using bits 16 to 25 142060 .520 .6983 OPSO for SG100.DAT using bits 15 to 24 141929 .068 .5270 OPSO for SG100.DAT using bits 14 to 23 141975 .226 .5896 OPSO for SG100.DAT using bits 13 to 22 142114 .706 .7598 OPSO for SG100.DAT using bits 12 to 21 141535 -1.291 .0984 OPSO for SG100.DAT using bits 11 to 20 141747 -.560 .2878 OPSO for SG100.DAT using bits 10 to 19 142167 .889 .8129 OPSO for SG100.DAT using bits 9 to 18 141718 -.660 .2547 OPSO for SG100.DAT using bits 8 to 17 142209 1.033 .8493 OPSO for SG100.DAT using bits 7 to 16 141934 .085 .5339 OPSO for SG100.DAT using bits 6 to 15 141859 -.174 .4311 OPSO for SG100.DAT using bits 5 to 14 141410 -1.722 .0426 OPSO for SG100.DAT using bits 4 to 13 142222 1.078 .8595 OPSO for SG100.DAT using bits 3 to 12 141659 -.863 .1940 OPSO for SG100.DAT using bits 2 to 11 142047 .475 .6825 OPSO for SG100.DAT using bits 1 to 10 142193 .978 .8360 OQSO test for generator SG100.DAT Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OQSO for SG100.DAT using bits 28 to 32 142465 1.884 .9702 OQSO for SG100.DAT using bits 27 to 31 141617 -.991 .1609 OQSO for SG100.DAT using bits 26 to 30 141894 -.052 .4793 OQSO for SG100.DAT using bits 25 to 29 141470 -1.489 .0682 OQSO for SG100.DAT using bits 24 to 28 141928 .063 .5252 OQSO for SG100.DAT using bits 23 to 27 142267 1.212 .8873 OQSO for SG100.DAT using bits 22 to 26 141749 -.543 .2934 OQSO for SG100.DAT using bits 21 to 25 141473 -1.479 .0696 OQSO for SG100.DAT using bits 20 to 24 142092 .619 .7321 OQSO for SG100.DAT using bits 19 to 23 142120 .714 .7624 OQSO for SG100.DAT using bits 18 to 22 142048 .470 .6808 OQSO for SG100.DAT using bits 17 to 21 141858 -.174 .4309 OQSO for SG100.DAT using bits 16 to 20 142111 .684 .7529 OQSO for SG100.DAT using bits 15 to 19 141522 -1.313 .0946 OQSO for SG100.DAT using bits 14 to 18 142184 .931 .8241 OQSO for SG100.DAT using bits 13 to 17 141730 -.608 .2716 OQSO for SG100.DAT using bits 12 to 16 141629 -.950 .1710 OQSO for SG100.DAT using bits 11 to 15 141991 .277 .6091 OQSO for SG100.DAT using bits 10 to 14 141792 -.398 .3454 OQSO for SG100.DAT using bits 9 to 13 141863 -.157 .4376 OQSO for SG100.DAT using bits 8 to 12 141447 -1.567 .0585 OQSO for SG100.DAT using bits 7 to 11 141956 .158 .5629 OQSO for SG100.DAT using bits 6 to 10 141929 .067 .5266 OQSO for SG100.DAT using bits 5 to 9 142342 1.467 .9288 OQSO for SG100.DAT using bits 4 to 8 142129 .745 .7718 OQSO for SG100.DAT using bits 3 to 7 142006 .328 .6284 OQSO for SG100.DAT using bits 2 to 6 141572 -1.143 .1264 OQSO for SG100.DAT using bits 1 to 5 141426 -1.638 .0507 DNA test for generator SG100.DAT Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p DNA for SG100.DAT using bits 31 to 32 141565 -1.016 .1549 DNA for SG100.DAT using bits 30 to 31 141623 -.845 .1992 DNA for SG100.DAT using bits 29 to 30 141319 -1.741 .0408 DNA for SG100.DAT using bits 28 to 29 141545 -1.075 .1413 DNA for SG100.DAT using bits 27 to 28 141534 -1.107 .1341 DNA for SG100.DAT using bits 26 to 27 141978 .203 .5803 DNA for SG100.DAT using bits 25 to 26 142095 .548 .7081 DNA for SG100.DAT using bits 24 to 25 141437 -1.393 .0818 DNA for SG100.DAT using bits 23 to 24 141847 -.184 .4271 DNA for SG100.DAT using bits 22 to 23 141959 .147 .5582 DNA for SG100.DAT using bits 21 to 22 141939 .088 .5349 DNA for SG100.DAT using bits 20 to 21 141604 -.901 .1839 DNA for SG100.DAT using bits 19 to 20 142019 .324 .6268 DNA for SG100.DAT using bits 18 to 19 141617 -.862 .1943 DNA for SG100.DAT using bits 17 to 18 142339 1.267 .8975 DNA for SG100.DAT using bits 16 to 17 142107 .583 .7201 DNA for SG100.DAT using bits 15 to 16 142363 1.338 .9096 DNA for SG100.DAT using bits 14 to 15 141648 -.771 .2204 DNA for SG100.DAT using bits 13 to 14 142102 .568 .7151 DNA for SG100.DAT using bits 12 to 13 141713 -.579 .2812 DNA for SG100.DAT using bits 11 to 12 142524 1.813 .9651 DNA for SG100.DAT using bits 10 to 11 141723 -.550 .2913 DNA for SG100.DAT using bits 9 to 10 142046 .403 .6566 DNA for SG100.DAT using bits 8 to 9 142373 1.368 .9143 DNA for SG100.DAT using bits 7 to 8 141894 -.045 .4820 DNA for SG100.DAT using bits 6 to 7 141222 -2.028 .0213 DNA for SG100.DAT using bits 5 to 6 141682 -.671 .2512 DNA for SG100.DAT using bits 4 to 5 142131 .654 .7434 DNA for SG100.DAT using bits 3 to 4 142307 1.173 .8796 DNA for SG100.DAT using bits 2 to 3 142155 .725 .7657 DNA for SG100.DAT using bits 1 to 2 142025 .341 .6335 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 SG100.DAT 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 SG100.DAT 2489.05 -.155 .438457 byte stream for SG100.DAT 2559.93 .848 .801665 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 2413.74 -1.220 .111244 bits 2 to 9 2548.37 .684 .753024 bits 3 to 10 2537.38 .529 .701486 bits 4 to 11 2428.28 -1.014 .155212 bits 5 to 12 2636.03 1.924 .972811 bits 6 to 13 2464.13 -.507 .305996 bits 7 to 14 2456.64 -.613 .269886 bits 8 to 15 2589.84 1.271 .898054 bits 9 to 16 2511.27 .159 .563300 bits 10 to 17 2430.62 -.981 .163254 bits 11 to 18 2527.38 .387 .650707 bits 12 to 19 2541.18 .582 .719840 bits 13 to 20 2461.69 -.542 .293971 bits 14 to 21 2330.63 -2.395 .008304 bits 15 to 22 2507.48 .106 .542138 bits 16 to 23 2522.38 .316 .624174 bits 17 to 24 2468.29 -.448 .326932 bits 18 to 25 2435.00 -.919 .178980 bits 19 to 26 2491.51 -.120 .452231 bits 20 to 27 2482.81 -.243 .403953 bits 21 to 28 2637.01 1.938 .973668 bits 22 to 29 2466.95 -.467 .320100 bits 23 to 30 2444.05 -.791 .214394 bits 24 to 31 2584.92 1.201 .885126 bits 25 to 32 2577.95 1.102 .864839 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 SG100.DAT Of 12,000 tries, the average no. of successes should be 3523 with sigma=21.9 Successes: 3557 z-score: 1.553 p-value: .939730 Successes: 3550 z-score: 1.233 p-value: .891189 Successes: 3506 z-score: -.776 p-value: .218799 Successes: 3502 z-score: -.959 p-value: .168804 Successes: 3556 z-score: 1.507 p-value: .934075 Successes: 3523 z-score: .000 p-value: .500000 Successes: 3517 z-score: -.274 p-value: .392053 Successes: 3539 z-score: .731 p-value: .767486 Successes: 3557 z-score: 1.553 p-value: .939730 Successes: 3549 z-score: 1.187 p-value: .882429 square size avg. no. parked sample sigma 100. 3535.600 20.587 KSTEST for the above 10: p= .945715 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 SG100.DAT Sample no. d^2 avg equiv uni 5 .3073 .4196 .265694 10 .6224 .6057 .465034 15 .0719 .7005 .069731 20 .0141 .7617 .014051 25 2.5423 .9465 .922313 30 1.0586 .8824 .654903 35 .8508 .8214 .574768 40 .2105 .7611 .190671 45 .7400 .7450 .524675 50 1.3736 .7899 .748560 55 .5317 .8405 .413977 60 .8544 .8232 .576305 65 .5630 .8249 .432100 70 .0735 .8211 .071233 75 4.2369 .8391 .985852 80 .5104 .8073 .401262 85 1.2002 .8116 .700678 90 .3804 .8260 .317741 95 1.0486 .8048 .651408 100 1.5839 .8236 .796456 MINIMUM DISTANCE TEST for SG100.DAT Result of KS test on 20 transformed mindist^2's: p-value= .752837 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 SG100.DAT sample no: 1 r^3= 41.137 p-value= .74621 sample no: 2 r^3= 7.369 p-value= .21780 sample no: 3 r^3= 24.243 p-value= .55430 sample no: 4 r^3= 35.577 p-value= .69453 sample no: 5 r^3= 24.337 p-value= .55569 sample no: 6 r^3= 2.268 p-value= .07281 sample no: 7 r^3= 3.260 p-value= .10298 sample no: 8 r^3= 47.719 p-value= .79620 sample no: 9 r^3= 17.620 p-value= .44420 sample no: 10 r^3= .868 p-value= .02851 sample no: 11 r^3= 23.506 p-value= .54320 sample no: 12 r^3= 23.901 p-value= .54918 sample no: 13 r^3= 48.215 p-value= .79954 sample no: 14 r^3= 119.179 p-value= .98118 sample no: 15 r^3= 31.909 p-value= .65480 sample no: 16 r^3= 29.470 p-value= .62557 sample no: 17 r^3= 34.265 p-value= .68088 sample no: 18 r^3= 11.700 p-value= .32294 sample no: 19 r^3= 14.170 p-value= .37645 sample no: 20 r^3= 73.255 p-value= .91300 A KS test is applied to those 20 p-values. --------------------------------------------------------- 3DSPHERES test for file SG100.DAT p-value= .243269 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 SG100.DAT Table of standardized frequency counts ( (obs-exp)/sqrt(exp) )^2 for j taking values <=6,7,8,...,47,>=48: .6 .1 -1.3 1.1 1.4 1.1 .2 1.4 .2 -.2 .9 -.1 -.4 .7 1.6 1.7 -1.9 -.8 -.7 -.4 .3 -.3 -.1 -1.5 .4 .9 -.8 -.4 -.2 .4 -.9 -.1 -.1 -.9 -.6 -1.0 .5 .2 .5 .4 -.6 -1.0 .8 Chi-square with 42 degrees of freedom: 30.647 z-score= -1.239 p-value= .097122 ______________________________________________________________ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 .330733 Test no. 2 p-value .232319 Test no. 3 p-value .893748 Test no. 4 p-value .057761 Test no. 5 p-value .662586 Test no. 6 p-value .447470 Test no. 7 p-value .916826 Test no. 8 p-value .584608 Test no. 9 p-value .919413 Test no. 10 p-value .258387 Results of the OSUM test for SG100.DAT KSTEST on the above 10 p-values: .107964 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 SG100.DAT Up and down runs in a sample of 10000 _________________________________________________ Run test for SG100.DAT : runs up; ks test for 10 p's: .508297 runs down; ks test for 10 p's: .373533 Run test for SG100.DAT : runs up; ks test for 10 p's: .188019 runs down; ks test for 10 p's: .230541 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 SG100.DAT No. of wins: Observed Expected 98211 98585.86 98211= No. of wins, z-score=-1.677 pvalue= .04681 Analysis of Throws-per-Game: Chisq= 22.20 for 20 degrees of freedom, p= .67012 Throws Observed Expected Chisq Sum 1 66367 66666.7 1.347 1.347 2 37696 37654.3 .046 1.393 3 27053 26954.7 .358 1.751 4 19610 19313.5 4.553 6.305 5 13787 13851.4 .300 6.604 6 9847 9943.5 .937 7.541 7 7198 7145.0 .393 7.934 8 5151 5139.1 .028 7.962 9 3723 3699.9 .145 8.107 10 2677 2666.3 .043 8.150 11 1880 1923.3 .976 9.126 12 1338 1388.7 1.854 10.980 13 997 1003.7 .045 11.024 14 772 726.1 2.896 13.921 15 530 525.8 .033 13.954 16 391 381.2 .255 14.208 17 256 276.5 1.526 15.734 18 198 200.8 .040 15.774 19 160 146.0 1.346 17.119 20 83 106.2 5.074 22.193 21 286 287.1 .004 22.198 SUMMARY FOR SG100.DAT p-value for no. of wins: .046811 p-value for throws/game: .670116 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Results of DIEHARD battery of tests sent to file SG100.TXT