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 block7.rng For a sample of size 500: mean block7.rng using bits 1 to 24 2.020 duplicate number number spacings observed expected 0 70. 67.668 1 131. 135.335 2 139. 135.335 3 88. 90.224 4 40. 45.112 5 21. 18.045 6 to INF 11. 8.282 Chisquare with 6 d.o.f. = 2.33 p-value= .112873 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block7.rng using bits 2 to 25 1.958 duplicate number number spacings observed expected 0 69. 67.668 1 135. 135.335 2 137. 135.335 3 89. 90.224 4 50. 45.112 5 17. 18.045 6 to INF 3. 8.282 Chisquare with 6 d.o.f. = 4.02 p-value= .326413 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block7.rng using bits 3 to 26 2.060 duplicate number number spacings observed expected 0 67. 67.668 1 129. 135.335 2 143. 135.335 3 81. 90.224 4 47. 45.112 5 18. 18.045 6 to INF 15. 8.282 Chisquare with 6 d.o.f. = 7.21 p-value= .698057 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block7.rng using bits 4 to 27 1.970 duplicate number number spacings observed expected 0 79. 67.668 1 127. 135.335 2 126. 135.335 3 96. 90.224 4 51. 45.112 5 13. 18.045 6 to INF 8. 8.282 Chisquare with 6 d.o.f. = 5.61 p-value= .532150 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block7.rng using bits 5 to 28 2.050 duplicate number number spacings observed expected 0 58. 67.668 1 141. 135.335 2 139. 135.335 3 85. 90.224 4 46. 45.112 5 21. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = 2.88 p-value= .175996 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block7.rng using bits 6 to 29 2.014 duplicate number number spacings observed expected 0 65. 67.668 1 134. 135.335 2 132. 135.335 3 87. 90.224 4 69. 45.112 5 7. 18.045 6 to INF 6. 8.282 Chisquare with 6 d.o.f. = 20.35 p-value= .997605 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block7.rng using bits 7 to 30 1.938 duplicate number number spacings observed expected 0 72. 67.668 1 132. 135.335 2 142. 135.335 3 92. 90.224 4 41. 45.112 5 15. 18.045 6 to INF 6. 8.282 Chisquare with 6 d.o.f. = 2.24 p-value= .103639 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block7.rng using bits 8 to 31 1.948 duplicate number number spacings observed expected 0 57. 67.668 1 150. 135.335 2 142. 135.335 3 97. 90.224 4 30. 45.112 5 19. 18.045 6 to INF 5. 8.282 Chisquare with 6 d.o.f. = 10.52 p-value= .895650 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block7.rng using bits 9 to 32 1.978 duplicate number number spacings observed expected 0 65. 67.668 1 142. 135.335 2 138. 135.335 3 83. 90.224 4 44. 45.112 5 24. 18.045 6 to INF 4. 8.282 Chisquare with 6 d.o.f. = 5.27 p-value= .490415 ::::::::::::::::::::::::::::::::::::::::: The 9 p-values were .112873 .326413 .698057 .532150 .175996 .997605 .103639 .895650 .490415 A KSTEST for the 9 p-values yields .282488 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block7.rng For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom= 79.893; p-value= .079479 OPERM5 test for file block7.rng For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=114.672; p-value= .865868 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block7.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 222 211.4 .529654 .530 29 5258 5134.0 2.994434 3.524 30 22990 23103.0 .553156 4.077 31 11530 11551.5 .040107 4.117 chisquare= 4.117 for 3 d. of f.; p-value= .772155 -------------------------------------------------------------- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block7.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 231 211.4 1.813725 1.814 30 5173 5134.0 .296104 2.110 31 22996 23103.0 .495997 2.606 32 11600 11551.5 .203426 2.809 chisquare= 2.809 for 3 d. of f.; p-value= .624882 -------------------------------------------------------------- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block7.rng Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 1 to 8 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 943 944.3 .002 .002 r =5 21369 21743.9 6.464 6.466 r =6 77688 77311.8 1.831 8.296 p=1-exp(-SUM/2)= .98421 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.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 21792 21743.9 .106 .114 r =6 77261 77311.8 .033 .147 p=1-exp(-SUM/2)= .07110 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 3 to 10 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1047 944.3 11.169 11.169 r =5 21753 21743.9 .004 11.173 r =6 77200 77311.8 .162 11.335 p=1-exp(-SUM/2)= .99654 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 4 to 11 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 925 944.3 .395 .395 r =5 21690 21743.9 .134 .528 r =6 77385 77311.8 .069 .597 p=1-exp(-SUM/2)= .25823 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 5 to 12 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 879 944.3 4.516 4.516 r =5 21669 21743.9 .258 4.774 r =6 77452 77311.8 .254 5.028 p=1-exp(-SUM/2)= .91906 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 6 to 13 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 918 944.3 .733 .733 r =5 21808 21743.9 .189 .922 r =6 77274 77311.8 .018 .940 p=1-exp(-SUM/2)= .37500 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 7 to 14 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 883 944.3 3.979 3.979 r =5 21599 21743.9 .966 4.945 r =6 77518 77311.8 .550 5.495 p=1-exp(-SUM/2)= .93591 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 8 to 15 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 928 944.3 .281 .281 r =5 21857 21743.9 .588 .870 r =6 77215 77311.8 .121 .991 p=1-exp(-SUM/2)= .39070 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 9 to 16 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1004 944.3 3.774 3.774 r =5 21616 21743.9 .752 4.526 r =6 77380 77311.8 .060 4.587 p=1-exp(-SUM/2)= .89907 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 10 to 17 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 943 944.3 .002 .002 r =5 21896 21743.9 1.064 1.066 r =6 77161 77311.8 .294 1.360 p=1-exp(-SUM/2)= .49336 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 11 to 18 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 907 944.3 1.473 1.473 r =5 21836 21743.9 .390 1.864 r =6 77257 77311.8 .039 1.902 p=1-exp(-SUM/2)= .61372 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 12 to 19 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 941 944.3 .012 .012 r =5 21578 21743.9 1.266 1.277 r =6 77481 77311.8 .370 1.648 p=1-exp(-SUM/2)= .56124 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 13 to 20 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 958 944.3 .199 .199 r =5 21770 21743.9 .031 .230 r =6 77272 77311.8 .020 .251 p=1-exp(-SUM/2)= .11774 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 14 to 21 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 958 944.3 .199 .199 r =5 21760 21743.9 .012 .211 r =6 77282 77311.8 .011 .222 p=1-exp(-SUM/2)= .10512 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 15 to 22 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 994 944.3 2.616 2.616 r =5 21878 21743.9 .827 3.443 r =6 77128 77311.8 .437 3.880 p=1-exp(-SUM/2)= .85627 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 16 to 23 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 932 944.3 .160 .160 r =5 21798 21743.9 .135 .295 r =6 77270 77311.8 .023 .317 p=1-exp(-SUM/2)= .14677 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 17 to 24 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 984 944.3 1.669 1.669 r =5 21527 21743.9 2.164 3.833 r =6 77489 77311.8 .406 4.239 p=1-exp(-SUM/2)= .87989 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 18 to 25 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 983 944.3 1.586 1.586 r =5 21876 21743.9 .803 2.388 r =6 77141 77311.8 .377 2.766 p=1-exp(-SUM/2)= .74915 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 19 to 26 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 938 944.3 .042 .042 r =5 21833 21743.9 .365 .407 r =6 77229 77311.8 .089 .496 p=1-exp(-SUM/2)= .21958 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 20 to 27 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 949 944.3 .023 .023 r =5 21765 21743.9 .020 .044 r =6 77286 77311.8 .009 .052 p=1-exp(-SUM/2)= .02589 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 21 to 28 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 999 944.3 3.168 3.168 r =5 21819 21743.9 .259 3.428 r =6 77182 77311.8 .218 3.646 p=1-exp(-SUM/2)= .83844 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 22 to 29 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 950 944.3 .034 .034 r =5 21826 21743.9 .310 .344 r =6 77224 77311.8 .100 .444 p=1-exp(-SUM/2)= .19912 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 23 to 30 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 963 944.3 .370 .370 r =5 21713 21743.9 .044 .414 r =6 77324 77311.8 .002 .416 p=1-exp(-SUM/2)= .18783 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 24 to 31 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 988 944.3 2.022 2.022 r =5 21864 21743.9 .663 2.686 r =6 77148 77311.8 .347 3.033 p=1-exp(-SUM/2)= .78048 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block7.rng b-rank test for bits 25 to 32 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 946 944.3 .003 .003 r =5 21617 21743.9 .741 .744 r =6 77437 77311.8 .203 .946 p=1-exp(-SUM/2)= .37699 TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices These should be 25 uniform [0,1] random variables: .984206 .071096 .996543 .258227 .919057 .375000 .935914 .390703 .899069 .493357 .613724 .561239 .117744 .105121 .856272 .146771 .879891 .749153 .219577 .025893 .838439 .199125 .187835 .780481 .376994 brank test summary for block7.rng The KS test for those 25 supposed UNI's yields KS p-value= .558088 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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: 141621 missing words, -.67 sigmas from mean, p-value= .25026 tst no 2: 141950 missing words, .10 sigmas from mean, p-value= .53785 tst no 3: 141541 missing words, -.86 sigmas from mean, p-value= .19473 tst no 4: 142871 missing words, 2.25 sigmas from mean, p-value= .98768 tst no 5: 141595 missing words, -.73 sigmas from mean, p-value= .23135 tst no 6: 141722 missing words, -.44 sigmas from mean, p-value= .33081 tst no 7: 141861 missing words, -.11 sigmas from mean, p-value= .45505 tst no 8: 142415 missing words, 1.18 sigmas from mean, p-value= .88129 tst no 9: 141673 missing words, -.55 sigmas from mean, p-value= .29042 tst no 10: 141273 missing words, -1.49 sigmas from mean, p-value= .06854 tst no 11: 141683 missing words, -.53 sigmas from mean, p-value= .29847 tst no 12: 141061 missing words, -1.98 sigmas from mean, p-value= .02374 tst no 13: 142007 missing words, .23 sigmas from mean, p-value= .59026 tst no 14: 141330 missing words, -1.35 sigmas from mean, p-value= .08794 tst no 15: 142562 missing words, 1.52 sigmas from mean, p-value= .93636 tst no 16: 142229 missing words, .75 sigmas from mean, p-value= .77244 tst no 17: 142178 missing words, .63 sigmas from mean, p-value= .73491 tst no 18: 142172 missing words, .61 sigmas from mean, p-value= .73030 tst no 19: 141751 missing words, -.37 sigmas from mean, p-value= .35572 tst no 20: 142016 missing words, .25 sigmas from mean, p-value= .59841 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block7.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OPSO for block7.rng using bits 23 to 32 142031 .420 .6626 OPSO for block7.rng using bits 22 to 31 141892 -.060 .4762 OPSO for block7.rng using bits 21 to 30 142042 .457 .6763 OPSO for block7.rng using bits 20 to 29 141920 .037 .5147 OPSO for block7.rng using bits 19 to 28 142114 .706 .7598 OPSO for block7.rng using bits 18 to 27 142297 1.337 .9094 OPSO for block7.rng using bits 17 to 26 142336 1.471 .9294 OPSO for block7.rng using bits 16 to 25 141936 .092 .5366 OPSO for block7.rng using bits 15 to 24 142349 1.516 .9353 OPSO for block7.rng using bits 14 to 23 141599 -1.070 .1423 OPSO for block7.rng using bits 13 to 22 141507 -1.387 .0827 OPSO for block7.rng using bits 12 to 21 141716 -.667 .2525 OPSO for block7.rng using bits 11 to 20 141735 -.601 .2739 OPSO for block7.rng using bits 10 to 19 141866 -.149 .4406 OPSO for block7.rng using bits 9 to 18 141789 -.415 .3391 OPSO for block7.rng using bits 8 to 17 142165 .882 .8110 OPSO for block7.rng using bits 7 to 16 142153 .840 .7996 OPSO for block7.rng using bits 6 to 15 141699 -.725 .2341 OPSO for block7.rng using bits 5 to 14 141682 -.784 .2166 OPSO for block7.rng using bits 4 to 13 142174 .913 .8193 OPSO for block7.rng using bits 3 to 12 142108 .685 .7534 OPSO for block7.rng using bits 2 to 11 141767 -.491 .3118 OPSO for block7.rng using bits 1 to 10 142071 .557 .7114 OQSO test for generator block7.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OQSO for block7.rng using bits 28 to 32 141417 -1.669 .0476 OQSO for block7.rng using bits 27 to 31 141885 -.082 .4671 OQSO for block7.rng using bits 26 to 30 141679 -.781 .2175 OQSO for block7.rng using bits 25 to 29 142498 1.995 .9770 OQSO for block7.rng using bits 24 to 28 142383 1.606 .9458 OQSO for block7.rng using bits 23 to 27 141743 -.564 .2864 OQSO for block7.rng using bits 22 to 26 141650 -.879 .1897 OQSO for block7.rng using bits 21 to 25 142042 .450 .6735 OQSO for block7.rng using bits 20 to 24 142112 .687 .7540 OQSO for block7.rng using bits 19 to 23 142479 1.931 .9733 OQSO for block7.rng using bits 18 to 22 142322 1.399 .9191 OQSO for block7.rng using bits 17 to 21 142163 .860 .8051 OQSO for block7.rng using bits 16 to 20 141799 -.374 .3542 OQSO for block7.rng using bits 15 to 19 141851 -.198 .4216 OQSO for block7.rng using bits 14 to 18 141496 -1.401 .0806 OQSO for block7.rng using bits 13 to 17 141855 -.184 .4269 OQSO for block7.rng using bits 12 to 16 141909 -.001 .4996 OQSO for block7.rng using bits 11 to 15 141766 -.486 .3135 OQSO for block7.rng using bits 10 to 14 141374 -1.815 .0348 OQSO for block7.rng using bits 9 to 13 141707 -.686 .2464 OQSO for block7.rng using bits 8 to 12 141973 .216 .5854 OQSO for block7.rng using bits 7 to 11 142142 .789 .7849 OQSO for block7.rng using bits 6 to 10 141584 -1.103 .1351 OQSO for block7.rng using bits 5 to 9 141951 .141 .5562 OQSO for block7.rng using bits 4 to 8 141504 -1.374 .0847 OQSO for block7.rng using bits 3 to 7 141547 -1.228 .1097 OQSO for block7.rng using bits 2 to 6 141632 -.940 .1736 OQSO for block7.rng using bits 1 to 5 141813 -.327 .3720 DNA test for generator block7.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p DNA for block7.rng using bits 31 to 32 141220 -2.033 .0210 DNA for block7.rng using bits 30 to 31 141515 -1.163 .1224 DNA for block7.rng using bits 29 to 30 141450 -1.355 .0877 DNA for block7.rng using bits 28 to 29 141584 -.960 .1686 DNA for block7.rng using bits 27 to 28 141795 -.337 .3680 DNA for block7.rng using bits 26 to 27 142217 .908 .8180 DNA for block7.rng using bits 25 to 26 141548 -1.066 .1432 DNA for block7.rng using bits 24 to 25 141503 -1.199 .1153 DNA for block7.rng using bits 23 to 24 142025 .341 .6335 DNA for block7.rng using bits 22 to 23 141775 -.396 .3460 DNA for block7.rng using bits 21 to 22 141777 -.390 .3481 DNA for block7.rng using bits 20 to 21 142388 1.412 .9210 DNA for block7.rng using bits 19 to 20 142100 .562 .7131 DNA for block7.rng using bits 18 to 19 141539 -1.092 .1373 DNA for block7.rng using bits 17 to 18 141819 -.266 .3949 DNA for block7.rng using bits 16 to 17 141949 .117 .5466 DNA for block7.rng using bits 15 to 16 141814 -.281 .3893 DNA for block7.rng using bits 14 to 15 141894 -.045 .4820 DNA for block7.rng using bits 13 to 14 141978 .203 .5803 DNA for block7.rng using bits 12 to 13 141489 -1.240 .1075 DNA for block7.rng using bits 11 to 12 141975 .194 .5768 DNA for block7.rng using bits 10 to 11 142183 .807 .7903 DNA for block7.rng using bits 9 to 10 141831 -.231 .4086 DNA for block7.rng using bits 8 to 9 141597 -.921 .1784 DNA for block7.rng using bits 7 to 8 141514 -1.166 .1218 DNA for block7.rng using bits 6 to 7 141890 -.057 .4773 DNA for block7.rng using bits 5 to 6 141752 -.464 .3213 DNA for block7.rng using bits 4 to 5 142441 1.568 .9416 DNA for block7.rng using bits 3 to 4 141630 -.824 .2050 DNA for block7.rng using bits 2 to 3 142319 1.208 .8866 DNA for block7.rng using bits 1 to 2 141620 -.853 .1967 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block7.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 block7.rng 2487.17 -.181 .427992 byte stream for block7.rng 2655.38 2.197 .986004 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 2671.31 2.423 .992296 bits 2 to 9 2530.80 .436 .668404 bits 3 to 10 2459.45 -.573 .283184 bits 4 to 11 2560.92 .861 .805514 bits 5 to 12 2559.04 .835 .798121 bits 6 to 13 2602.63 1.451 .926676 bits 7 to 14 2359.06 -1.993 .023123 bits 8 to 15 2525.92 .367 .643040 bits 9 to 16 2403.80 -1.360 .086846 bits 10 to 17 2453.50 -.658 .255385 bits 11 to 18 2441.18 -.832 .202762 bits 12 to 19 2569.72 .986 .837940 bits 13 to 20 2555.82 .789 .785081 bits 14 to 21 2416.67 -1.178 .119306 bits 15 to 22 2665.60 2.342 .990409 bits 16 to 23 2637.61 1.946 .974176 bits 17 to 24 2583.10 1.175 .880045 bits 18 to 25 2505.24 .074 .529563 bits 19 to 26 2498.78 -.017 .493110 bits 20 to 27 2429.44 -.998 .159179 bits 21 to 28 2578.95 1.117 .867904 bits 22 to 29 2422.27 -1.099 .135822 bits 23 to 30 2560.72 .859 .804757 bits 24 to 31 2447.31 -.745 .228083 bits 25 to 32 2623.04 1.740 .959080 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block7.rng Of 12,000 tries, the average no. of successes should be 3523 with sigma=21.9 Successes: 3576 z-score: 2.420 p-value: .992242 Successes: 3487 z-score: -1.644 p-value: .050105 Successes: 3586 z-score: 2.877 p-value: .997991 Successes: 3502 z-score: -.959 p-value: .168804 Successes: 3501 z-score: -1.005 p-value: .157553 Successes: 3533 z-score: .457 p-value: .676028 Successes: 3502 z-score: -.959 p-value: .168804 Successes: 3552 z-score: 1.324 p-value: .907282 Successes: 3555 z-score: 1.461 p-value: .928018 Successes: 3504 z-score: -.868 p-value: .192812 square size avg. no. parked sample sigma 100. 3529.800 33.621 KSTEST for the above 10: p= .942137 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block7.rng Sample no. d^2 avg equiv uni 5 .6298 1.2579 .468992 10 .4375 1.0111 .355762 15 .2750 .9661 .241502 20 1.8928 .8954 .850770 25 .3661 .7976 .307844 30 .5591 .7787 .429891 35 1.1869 .7616 .696662 40 2.4796 .8077 .917257 45 .5980 .8196 .451718 50 .7859 .8383 .546078 55 .2071 .8181 .187945 60 .9889 .8003 .629864 65 .4289 .7858 .350155 70 .7257 .7641 .517774 75 2.2272 .7788 .893371 80 .1968 .7566 .179480 85 .0156 .7603 .015588 90 .3938 .7972 .326867 95 1.6271 .7931 .805103 100 .1752 .8205 .161470 MINIMUM DISTANCE TEST for block7.rng Result of KS test on 20 transformed mindist^2's: p-value= .739882 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block7.rng sample no: 1 r^3= 37.433 p-value= .71286 sample no: 2 r^3= .306 p-value= .01016 sample no: 3 r^3= 43.498 p-value= .76541 sample no: 4 r^3= 9.718 p-value= .27669 sample no: 5 r^3= 11.180 p-value= .31110 sample no: 6 r^3= 48.293 p-value= .80007 sample no: 7 r^3= 17.462 p-value= .44126 sample no: 8 r^3= 55.525 p-value= .84290 sample no: 9 r^3= 27.461 p-value= .59964 sample no: 10 r^3= 62.657 p-value= .87614 sample no: 11 r^3= 4.779 p-value= .14726 sample no: 12 r^3= 44.232 p-value= .77109 sample no: 13 r^3= 13.391 p-value= .36006 sample no: 14 r^3= 16.130 p-value= .41590 sample no: 15 r^3= 35.358 p-value= .69229 sample no: 16 r^3= 7.551 p-value= .22253 sample no: 17 r^3= 108.515 p-value= .97314 sample no: 18 r^3= 6.018 p-value= .18175 sample no: 19 r^3= 44.436 p-value= .77263 sample no: 20 r^3= 5.681 p-value= .17253 A KS test is applied to those 20 p-values. --------------------------------------------------------- 3DSPHERES test for file block7.rng p-value= .098354 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block7.rng Table of standardized frequency counts ( (obs-exp)/sqrt(exp) )^2 for j taking values <=6,7,8,...,47,>=48: -1.5 1.8 -.4 -.8 1.2 .0 .1 -.7 1.7 .9 .9 .2 -1.1 -.4 .5 -.4 -.2 -.6 .9 -1.0 .2 -.2 .1 -.5 1.7 1.1 .6 -.6 -.8 -.4 .3 -1.7 -.3 -1.7 -.9 -1.6 -1.4 -1.7 -2.0 -.7 -.6 1.0 -1.1 Chi-square with 42 degrees of freedom: 43.734 z-score= .189 p-value= .602332 ______________________________________________________________ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 .676187 Test no. 2 p-value .186294 Test no. 3 p-value .022401 Test no. 4 p-value .617651 Test no. 5 p-value .544124 Test no. 6 p-value .302474 Test no. 7 p-value .557463 Test no. 8 p-value .802135 Test no. 9 p-value .411520 Test no. 10 p-value .563264 Results of the OSUM test for block7.rng KSTEST on the above 10 p-values: .378851 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block7.rng Up and down runs in a sample of 10000 _________________________________________________ Run test for block7.rng : runs up; ks test for 10 p's: .096866 runs down; ks test for 10 p's: .802117 Run test for block7.rng : runs up; ks test for 10 p's: .563537 runs down; ks test for 10 p's: .400210 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block7.rng No. of wins: Observed Expected 98425 98585.86 98425= No. of wins, z-score= -.719 pvalue= .23593 Analysis of Throws-per-Game: Chisq= 17.64 for 20 degrees of freedom, p= .38884 Throws Observed Expected Chisq Sum 1 66636 66666.7 .014 .014 2 37642 37654.3 .004 .018 3 27016 26954.7 .139 .157 4 19231 19313.5 .352 .509 5 14029 13851.4 2.277 2.786 6 9950 9943.5 .004 2.790 7 7061 7145.0 .988 3.778 8 5032 5139.1 2.231 6.009 9 3743 3699.9 .503 6.512 10 2708 2666.3 .652 7.164 11 1873 1923.3 1.317 8.481 12 1394 1388.7 .020 8.501 13 1009 1003.7 .028 8.529 14 740 726.1 .265 8.794 15 490 525.8 2.442 11.236 16 405 381.2 1.492 12.728 17 280 276.5 .043 12.772 18 216 200.8 1.146 13.917 19 141 146.0 .170 14.088 20 125 106.2 3.322 17.410 21 279 287.1 .229 17.639 SUMMARY FOR block7.rng p-value for no. of wins: .235930 p-value for throws/game: .388841 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Results of DIEHARD battery of tests sent to file report7.txt