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 block0.rng For a sample of size 500: mean block0.rng using bits 1 to 24 1.916 duplicate number number spacings observed expected 0 61. 67.668 1 141. 135.335 2 157. 135.335 3 88. 90.224 4 35. 45.112 5 11. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 9.63 p-value= .858982 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block0.rng using bits 2 to 25 1.910 duplicate number number spacings observed expected 0 69. 67.668 1 142. 135.335 2 144. 135.335 3 85. 90.224 4 44. 45.112 5 7. 18.045 6 to INF 9. 8.282 Chisquare with 6 d.o.f. = 8.06 p-value= .766366 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block0.rng using bits 3 to 26 1.996 duplicate number number spacings observed expected 0 65. 67.668 1 145. 135.335 2 130. 135.335 3 89. 90.224 4 47. 45.112 5 14. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = 2.36 p-value= .116675 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block0.rng using bits 4 to 27 2.022 duplicate number number spacings observed expected 0 72. 67.668 1 132. 135.335 2 118. 135.335 3 97. 90.224 4 55. 45.112 5 24. 18.045 6 to INF 2. 8.282 Chisquare with 6 d.o.f. = 11.99 p-value= .937734 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block0.rng using bits 5 to 28 1.960 duplicate number number spacings observed expected 0 69. 67.668 1 140. 135.335 2 136. 135.335 3 83. 90.224 4 49. 45.112 5 15. 18.045 6 to INF 8. 8.282 Chisquare with 6 d.o.f. = 1.63 p-value= .049389 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block0.rng using bits 6 to 29 2.024 duplicate number number spacings observed expected 0 54. 67.668 1 138. 135.335 2 147. 135.335 3 89. 90.224 4 53. 45.112 5 16. 18.045 6 to INF 3. 8.282 Chisquare with 6 d.o.f. = 8.81 p-value= .815725 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block0.rng using bits 7 to 30 2.038 duplicate number number spacings observed expected 0 72. 67.668 1 114. 135.335 2 144. 135.335 3 97. 90.224 4 48. 45.112 5 16. 18.045 6 to INF 9. 8.282 Chisquare with 6 d.o.f. = 5.18 p-value= .479490 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block0.rng using bits 8 to 31 1.972 duplicate number number spacings observed expected 0 68. 67.668 1 151. 135.335 2 125. 135.335 3 81. 90.224 4 49. 45.112 5 15. 18.045 6 to INF 11. 8.282 Chisquare with 6 d.o.f. = 5.29 p-value= .492559 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block0.rng using bits 9 to 32 2.026 duplicate number number spacings observed expected 0 63. 67.668 1 141. 135.335 2 133. 135.335 3 82. 90.224 4 53. 45.112 5 21. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 3.41 p-value= .244183 ::::::::::::::::::::::::::::::::::::::::: The 9 p-values were .858982 .766366 .116675 .937734 .049389 .815725 .479490 .492559 .244183 A KSTEST for the 9 p-values yields .079935 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block0.rng For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom= 71.452; p-value= .016727 OPERM5 test for file block0.rng For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=107.158; p-value= .729698 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block0.rng Rank test for 31x31 binary matrices: rows from leftmost 31 bits of each 32-bit integer rank observed expected (o-e)^2/e sum 28 230 211.4 1.633211 1.633 29 5098 5134.0 .252578 1.886 30 23055 23103.0 .099922 1.986 31 11617 11551.5 .371124 2.357 chisquare= 2.357 for 3 d. of f.; p-value= .560648 -------------------------------------------------------------- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block0.rng Rank test for 32x32 binary matrices: rows from leftmost 32 bits of each 32-bit integer rank observed expected (o-e)^2/e sum 29 179 211.4 4.970852 4.971 30 5046 5134.0 1.508724 6.480 31 23244 23103.0 .859964 7.340 32 11531 11551.5 .036467 7.376 chisquare= 7.376 for 3 d. of f.; p-value= .942474 -------------------------------------------------------------- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block0.rng Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 1 to 8 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 983 944.3 1.586 1.586 r =5 21743 21743.9 .000 1.586 r =6 77274 77311.8 .018 1.604 p=1-exp(-SUM/2)= .55167 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 2 to 9 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 947 944.3 .008 .008 r =5 21737 21743.9 .002 .010 r =6 77316 77311.8 .000 .010 p=1-exp(-SUM/2)= .00505 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 3 to 10 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 937 944.3 .056 .056 r =5 21629 21743.9 .607 .664 r =6 77434 77311.8 .193 .857 p=1-exp(-SUM/2)= .34843 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 4 to 11 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 939 944.3 .030 .030 r =5 21771 21743.9 .034 .064 r =6 77290 77311.8 .006 .070 p=1-exp(-SUM/2)= .03424 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 5 to 12 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 947 944.3 .008 .008 r =5 21644 21743.9 .459 .467 r =6 77409 77311.8 .122 .589 p=1-exp(-SUM/2)= .25505 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 6 to 13 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 935 944.3 .092 .092 r =5 21715 21743.9 .038 .130 r =6 77350 77311.8 .019 .149 p=1-exp(-SUM/2)= .07175 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 7 to 14 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 943 944.3 .002 .002 r =5 21622 21743.9 .683 .685 r =6 77435 77311.8 .196 .881 p=1-exp(-SUM/2)= .35645 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 8 to 15 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 954 944.3 .100 .100 r =5 21723 21743.9 .020 .120 r =6 77323 77311.8 .002 .121 p=1-exp(-SUM/2)= .05886 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 9 to 16 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 945 944.3 .001 .001 r =5 21999 21743.9 2.993 2.993 r =6 77056 77311.8 .846 3.840 p=1-exp(-SUM/2)= .85337 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 10 to 17 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 950 944.3 .034 .034 r =5 21714 21743.9 .041 .076 r =6 77336 77311.8 .008 .083 p=1-exp(-SUM/2)= .04069 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 11 to 18 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 940 944.3 .020 .020 r =5 21783 21743.9 .070 .090 r =6 77277 77311.8 .016 .106 p=1-exp(-SUM/2)= .05142 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 12 to 19 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 967 944.3 .546 .546 r =5 21873 21743.9 .767 1.312 r =6 77160 77311.8 .298 1.610 p=1-exp(-SUM/2)= .55296 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 13 to 20 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 956 944.3 .145 .145 r =5 21747 21743.9 .000 .145 r =6 77297 77311.8 .003 .148 p=1-exp(-SUM/2)= .07143 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 14 to 21 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 932 944.3 .160 .160 r =5 21683 21743.9 .171 .331 r =6 77385 77311.8 .069 .400 p=1-exp(-SUM/2)= .18132 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 15 to 22 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 926 944.3 .355 .355 r =5 21735 21743.9 .004 .358 r =6 77339 77311.8 .010 .368 p=1-exp(-SUM/2)= .16802 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 16 to 23 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 914 944.3 .972 .972 r =5 21719 21743.9 .029 1.001 r =6 77367 77311.8 .039 1.040 p=1-exp(-SUM/2)= .40555 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 17 to 24 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 943 944.3 .002 .002 r =5 21508 21743.9 2.559 2.561 r =6 77549 77311.8 .728 3.289 p=1-exp(-SUM/2)= .80687 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 18 to 25 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 929 944.3 .248 .248 r =5 21505 21743.9 2.625 2.873 r =6 77566 77311.8 .836 3.709 p=1-exp(-SUM/2)= .84343 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 19 to 26 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 942 944.3 .006 .006 r =5 21726 21743.9 .015 .020 r =6 77332 77311.8 .005 .026 p=1-exp(-SUM/2)= .01273 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 20 to 27 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 924 944.3 .436 .436 r =5 21811 21743.9 .207 .644 r =6 77265 77311.8 .028 .672 p=1-exp(-SUM/2)= .28532 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 21 to 28 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 953 944.3 .080 .080 r =5 21648 21743.9 .423 .503 r =6 77399 77311.8 .098 .601 p=1-exp(-SUM/2)= .25971 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 22 to 29 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 904 944.3 1.720 1.720 r =5 21816 21743.9 .239 1.959 r =6 77280 77311.8 .013 1.972 p=1-exp(-SUM/2)= .62696 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 23 to 30 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 921 944.3 .575 .575 r =5 21868 21743.9 .708 1.283 r =6 77211 77311.8 .131 1.415 p=1-exp(-SUM/2)= .50705 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 24 to 31 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 969 944.3 .646 .646 r =5 22030 21743.9 3.764 4.410 r =6 77001 77311.8 1.249 5.660 p=1-exp(-SUM/2)= .94098 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block0.rng b-rank test for bits 25 to 32 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 939 944.3 .030 .030 r =5 21846 21743.9 .479 .509 r =6 77215 77311.8 .121 .630 p=1-exp(-SUM/2)= .27035 TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices These should be 25 uniform [0,1] random variables: .551670 .005052 .348434 .034243 .255055 .071746 .356446 .058859 .853374 .040689 .051416 .552956 .071426 .181316 .168023 .405552 .806872 .843431 .012728 .285323 .259714 .626962 .507048 .940984 .270353 brank test summary for block0.rng The KS test for those 25 supposed UNI's yields KS p-value= .995340 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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: 141905 missing words, -.01 sigmas from mean, p-value= .49597 tst no 2: 141555 missing words, -.83 sigmas from mean, p-value= .20387 tst no 3: 142103 missing words, .45 sigmas from mean, p-value= .67455 tst no 4: 141847 missing words, -.15 sigmas from mean, p-value= .44211 tst no 5: 142169 missing words, .61 sigmas from mean, p-value= .72798 tst no 6: 140896 missing words, -2.37 sigmas from mean, p-value= .00895 tst no 7: 142178 missing words, .63 sigmas from mean, p-value= .73491 tst no 8: 142889 missing words, 2.29 sigmas from mean, p-value= .98896 tst no 9: 141382 missing words, -1.23 sigmas from mean, p-value= .10896 tst no 10: 141974 missing words, .15 sigmas from mean, p-value= .56005 tst no 11: 142468 missing words, 1.31 sigmas from mean, p-value= .90411 tst no 12: 141087 missing words, -1.92 sigmas from mean, p-value= .02735 tst no 13: 142862 missing words, 2.23 sigmas from mean, p-value= .98699 tst no 14: 141593 missing words, -.74 sigmas from mean, p-value= .22993 tst no 15: 142527 missing words, 1.44 sigmas from mean, p-value= .92551 tst no 16: 141849 missing words, -.14 sigmas from mean, p-value= .44395 tst no 17: 141384 missing words, -1.23 sigmas from mean, p-value= .10984 tst no 18: 142783 missing words, 2.04 sigmas from mean, p-value= .97939 tst no 19: 141599 missing words, -.73 sigmas from mean, p-value= .23421 tst no 20: 141377 missing words, -1.24 sigmas from mean, p-value= .10679 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block0.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OPSO for block0.rng using bits 23 to 32 142244 1.154 .8758 OPSO for block0.rng using bits 22 to 31 142035 .433 .6676 OPSO for block0.rng using bits 21 to 30 141494 -1.432 .0760 OPSO for block0.rng using bits 20 to 29 141726 -.632 .2636 OPSO for block0.rng using bits 19 to 28 141593 -1.091 .1377 OPSO for block0.rng using bits 18 to 27 142055 .502 .6923 OPSO for block0.rng using bits 17 to 26 141315 -2.049 .0202 OPSO for block0.rng using bits 16 to 25 141424 -1.674 .0471 OPSO for block0.rng using bits 15 to 24 141745 -.567 .2855 OPSO for block0.rng using bits 14 to 23 141832 -.267 .3949 OPSO for block0.rng using bits 13 to 22 141643 -.918 .1792 OPSO for block0.rng using bits 12 to 21 141954 .154 .5612 OPSO for block0.rng using bits 11 to 20 141985 .261 .6029 OPSO for block0.rng using bits 10 to 19 141876 -.115 .4543 OPSO for block0.rng using bits 9 to 18 142271 1.247 .8938 OPSO for block0.rng using bits 8 to 17 141999 .309 .6214 OPSO for block0.rng using bits 7 to 16 141869 -.139 .4447 OPSO for block0.rng using bits 6 to 15 141857 -.180 .4284 OPSO for block0.rng using bits 5 to 14 141856 -.184 .4270 OPSO for block0.rng using bits 4 to 13 142131 .764 .7777 OPSO for block0.rng using bits 3 to 12 142168 .892 .8138 OPSO for block0.rng using bits 2 to 11 142080 .589 .7219 OPSO for block0.rng using bits 1 to 10 141612 -1.025 .1526 OQSO test for generator block0.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OQSO for block0.rng using bits 28 to 32 141672 -.805 .2106 OQSO for block0.rng using bits 27 to 31 141611 -1.011 .1559 OQSO for block0.rng using bits 26 to 30 142281 1.260 .8961 OQSO for block0.rng using bits 25 to 29 141774 -.459 .3232 OQSO for block0.rng using bits 24 to 28 142034 .423 .6637 OQSO for block0.rng using bits 23 to 27 142468 1.894 .9709 OQSO for block0.rng using bits 22 to 26 142100 .646 .7410 OQSO for block0.rng using bits 21 to 25 141932 .077 .5306 OQSO for block0.rng using bits 20 to 24 142181 .921 .8215 OQSO for block0.rng using bits 19 to 23 141312 -2.025 .0214 OQSO for block0.rng using bits 18 to 22 141852 -.194 .4230 OQSO for block0.rng using bits 17 to 21 142487 1.958 .9749 OQSO for block0.rng using bits 16 to 20 142074 .558 .7116 OQSO for block0.rng using bits 15 to 19 142282 1.263 .8968 OQSO for block0.rng using bits 14 to 18 142175 .901 .8161 OQSO for block0.rng using bits 13 to 17 141888 -.072 .4712 OQSO for block0.rng using bits 12 to 16 141469 -1.493 .0678 OQSO for block0.rng using bits 11 to 15 142293 1.301 .9033 OQSO for block0.rng using bits 10 to 14 142003 .318 .6246 OQSO for block0.rng using bits 9 to 13 141766 -.486 .3135 OQSO for block0.rng using bits 8 to 12 141867 -.143 .4430 OQSO for block0.rng using bits 7 to 11 142185 .934 .8250 OQSO for block0.rng using bits 6 to 10 142017 .365 .6424 OQSO for block0.rng using bits 5 to 9 142440 1.799 .9640 OQSO for block0.rng using bits 4 to 8 141971 .209 .5828 OQSO for block0.rng using bits 3 to 7 141716 -.655 .2561 OQSO for block0.rng using bits 2 to 6 141133 -2.632 .0042 OQSO for block0.rng using bits 1 to 5 142095 .629 .7355 DNA test for generator block0.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p DNA for block0.rng using bits 31 to 32 142113 .601 .7260 DNA for block0.rng using bits 30 to 31 142436 1.554 .9399 DNA for block0.rng using bits 29 to 30 142500 1.742 .9593 DNA for block0.rng using bits 28 to 29 141793 -.343 .3657 DNA for block0.rng using bits 27 to 28 142059 .442 .6706 DNA for block0.rng using bits 26 to 27 141946 .108 .5431 DNA for block0.rng using bits 25 to 26 142110 .592 .7231 DNA for block0.rng using bits 24 to 25 142596 2.026 .9786 DNA for block0.rng using bits 23 to 24 142252 1.011 .8440 DNA for block0.rng using bits 22 to 23 142398 1.442 .9253 DNA for block0.rng using bits 21 to 22 141887 -.066 .4737 DNA for block0.rng using bits 20 to 21 141697 -.626 .2655 DNA for block0.rng using bits 19 to 20 141989 .235 .5929 DNA for block0.rng using bits 18 to 19 141340 -1.679 .0465 DNA for block0.rng using bits 17 to 18 142239 .972 .8346 DNA for block0.rng using bits 16 to 17 141424 -1.432 .0761 DNA for block0.rng using bits 15 to 16 142643 2.164 .9848 DNA for block0.rng using bits 14 to 15 141879 -.089 .4644 DNA for block0.rng using bits 13 to 14 142159 .736 .7693 DNA for block0.rng using bits 12 to 13 141770 -.411 .3405 DNA for block0.rng using bits 11 to 12 141704 -.606 .2724 DNA for block0.rng using bits 10 to 11 141889 -.060 .4761 DNA for block0.rng using bits 9 to 10 142157 .731 .7675 DNA for block0.rng using bits 8 to 9 141965 .164 .5652 DNA for block0.rng using bits 7 to 8 141840 -.205 .4190 DNA for block0.rng using bits 6 to 7 142055 .430 .6663 DNA for block0.rng using bits 5 to 6 142161 .742 .7711 DNA for block0.rng using bits 4 to 5 142031 .359 .6402 DNA for block0.rng using bits 3 to 4 142048 .409 .6588 DNA for block0.rng using bits 2 to 3 141338 -1.685 .0460 DNA for block0.rng using bits 1 to 2 141970 .179 .5710 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block0.rng Chi-square with 5^5-5^4=2500 d.of f. for sample size:2560000 chisquare equiv normal p-value Results fo COUNT-THE-1's in successive bytes: byte stream for block0.rng 2446.69 -.754 .225440 byte stream for block0.rng 2534.80 .492 .688677 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 2517.72 .251 .598921 bits 2 to 9 2482.71 -.245 .403390 bits 3 to 10 2576.00 1.075 .858760 bits 4 to 11 2488.60 -.161 .435936 bits 5 to 12 2513.93 .197 .578093 bits 6 to 13 2552.13 .737 .769492 bits 7 to 14 2562.49 .884 .811579 bits 8 to 15 2508.38 .119 .547195 bits 9 to 16 2481.69 -.259 .397849 bits 10 to 17 2417.92 -1.161 .122852 bits 11 to 18 2551.41 .727 .766406 bits 12 to 19 2470.37 -.419 .337613 bits 13 to 20 2525.04 .354 .638356 bits 14 to 21 2490.29 -.137 .445373 bits 15 to 22 2564.41 .911 .818810 bits 16 to 23 2557.52 .813 .792012 bits 17 to 24 2518.44 .261 .602889 bits 18 to 25 2373.56 -1.788 .036877 bits 19 to 26 2483.70 -.230 .408872 bits 20 to 27 2532.05 .453 .674809 bits 21 to 28 2480.42 -.277 .390920 bits 22 to 29 2496.15 -.055 .478261 bits 23 to 30 2489.79 -.144 .442617 bits 24 to 31 2460.15 -.564 .286518 bits 25 to 32 2599.73 1.410 .920780 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block0.rng Of 12,000 tries, the average no. of successes should be 3523 with sigma=21.9 Successes: 3532 z-score: .411 p-value: .659449 Successes: 3489 z-score: -1.553 p-value: .060270 Successes: 3504 z-score: -.868 p-value: .192812 Successes: 3523 z-score: .000 p-value: .500000 Successes: 3517 z-score: -.274 p-value: .392053 Successes: 3528 z-score: .228 p-value: .590298 Successes: 3521 z-score: -.091 p-value: .463618 Successes: 3508 z-score: -.685 p-value: .246694 Successes: 3517 z-score: -.274 p-value: .392053 Successes: 3565 z-score: 1.918 p-value: .972432 square size avg. no. parked sample sigma 100. 3520.400 19.012 KSTEST for the above 10: p= .300390 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block0.rng Sample no. d^2 avg equiv uni 5 .1127 .6202 .107114 10 .3265 .5722 .279752 15 1.5969 .8933 .799101 20 .4793 .8284 .382297 25 .0679 .7958 .065992 30 3.1047 .9657 .955856 35 1.0304 1.0735 .644983 40 .3540 1.0087 .299374 45 1.3808 .9832 .750369 50 .9728 .9870 .623819 55 4.6340 1.0585 .990508 60 .8098 1.0668 .556858 65 1.0949 1.0389 .667256 70 .3421 .9843 .290915 75 .0461 .9883 .045309 80 1.3411 .9657 .740190 85 .3548 .9493 .299955 90 .5121 1.0054 .402281 95 .5599 .9958 .430317 100 .7538 .9921 .531210 MINIMUM DISTANCE TEST for block0.rng Result of KS test on 20 transformed mindist^2's: p-value= .223584 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block0.rng sample no: 1 r^3= 23.673 p-value= .54575 sample no: 2 r^3= 5.165 p-value= .15816 sample no: 3 r^3= 38.008 p-value= .71830 sample no: 4 r^3= 29.919 p-value= .63112 sample no: 5 r^3= 19.700 p-value= .48142 sample no: 6 r^3= 57.646 p-value= .85362 sample no: 7 r^3= 14.649 p-value= .38632 sample no: 8 r^3= 84.430 p-value= .94006 sample no: 9 r^3= 10.395 p-value= .29283 sample no: 10 r^3= 15.515 p-value= .40378 sample no: 11 r^3= 20.948 p-value= .50255 sample no: 12 r^3= 81.798 p-value= .93456 sample no: 13 r^3= 16.334 p-value= .41984 sample no: 14 r^3= 31.497 p-value= .65003 sample no: 15 r^3= 3.279 p-value= .10354 sample no: 16 r^3= 7.895 p-value= .23140 sample no: 17 r^3= 37.448 p-value= .71299 sample no: 18 r^3= 61.286 p-value= .87034 sample no: 19 r^3= 5.064 p-value= .15533 sample no: 20 r^3= 14.611 p-value= .38555 A KS test is applied to those 20 p-values. --------------------------------------------------------- 3DSPHERES test for file block0.rng p-value= .133599 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block0.rng Table of standardized frequency counts ( (obs-exp)/sqrt(exp) )^2 for j taking values <=6,7,8,...,47,>=48: -.1 1.8 -.4 -1.1 1.1 .2 .2 .8 .6 -.1 -.7 1.1 1.1 1.0 .6 .0 -.9 -.8 -.2 -.7 .0 -.9 -.4 -.6 -.3 -.2 .2 .7 1.5 .6 1.2 -.5 .0 .5 .1 -1.7 .3 .8 -1.2 -1.8 -.6 1.0 -.1 Chi-square with 42 degrees of freedom: 29.384 z-score= -1.377 p-value= .070700 ______________________________________________________________ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 .024581 Test no. 2 p-value .783819 Test no. 3 p-value .126377 Test no. 4 p-value .805804 Test no. 5 p-value .956854 Test no. 6 p-value .747899 Test no. 7 p-value .738569 Test no. 8 p-value .332539 Test no. 9 p-value .290589 Test no. 10 p-value .241737 Results of the OSUM test for block0.rng KSTEST on the above 10 p-values: .162389 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block0.rng Up and down runs in a sample of 10000 _________________________________________________ Run test for block0.rng : runs up; ks test for 10 p's: .895588 runs down; ks test for 10 p's: .103022 Run test for block0.rng : runs up; ks test for 10 p's: .689373 runs down; ks test for 10 p's: .526976 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block0.rng No. of wins: Observed Expected 98204 98585.86 98204= No. of wins, z-score=-1.708 pvalue= .04383 Analysis of Throws-per-Game: Chisq= 23.90 for 20 degrees of freedom, p= .75316 Throws Observed Expected Chisq Sum 1 66462 66666.7 .628 .628 2 37635 37654.3 .010 .638 3 26885 26954.7 .180 .819 4 19335 19313.5 .024 .843 5 13990 13851.4 1.386 2.229 6 10053 9943.5 1.205 3.434 7 7095 7145.0 .350 3.784 8 5140 5139.1 .000 3.784 9 3733 3699.9 .297 4.081 10 2769 2666.3 3.956 8.037 11 1904 1923.3 .194 8.232 12 1364 1388.7 .441 8.672 13 1038 1003.7 1.171 9.843 14 715 726.1 .171 10.014 15 508 525.8 .605 10.619 16 404 381.2 1.370 11.989 17 258 276.5 1.243 13.232 18 163 200.8 7.126 20.358 19 156 146.0 .687 21.045 20 121 106.2 2.058 23.103 21 272 287.1 .796 23.899 SUMMARY FOR block0.rng p-value for no. of wins: .043828 p-value for throws/game: .753159 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Results of DIEHARD battery of tests sent to file report0.txt