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 random_neum.pcm For a sample of size 500: mean random_neum.pcm using bits 1 to 24 1.986 duplicate number number spacings observed expected 0 69. 67.668 1 136. 135.335 2 124. 135.335 3 109. 90.224 4 38. 45.112 5 15. 18.045 6 to INF 9. 8.282 Chisquare with 6 d.o.f. = 6.58 p-value= .638931 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean random_neum.pcm using bits 2 to 25 1.874 duplicate number number spacings observed expected 0 72. 67.668 1 134. 135.335 2 157. 135.335 3 84. 90.224 4 36. 45.112 5 11. 18.045 6 to INF 6. 8.282 Chisquare with 6 d.o.f. = 9.41 p-value= .848068 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean random_neum.pcm using bits 3 to 26 1.998 duplicate number number spacings observed expected 0 58. 67.668 1 145. 135.335 2 136. 135.335 3 88. 90.224 4 55. 45.112 5 14. 18.045 6 to INF 4. 8.282 Chisquare with 6 d.o.f. = 7.42 p-value= .716026 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean random_neum.pcm using bits 4 to 27 2.014 duplicate number number spacings observed expected 0 66. 67.668 1 124. 135.335 2 144. 135.335 3 101. 90.224 4 46. 45.112 5 10. 18.045 6 to INF 9. 8.282 Chisquare with 6 d.o.f. = 6.50 p-value= .630299 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean random_neum.pcm using bits 5 to 28 1.944 duplicate number number spacings observed expected 0 75. 67.668 1 141. 135.335 2 132. 135.335 3 82. 90.224 4 39. 45.112 5 21. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = 3.53 p-value= .260275 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean random_neum.pcm using bits 6 to 29 1.962 duplicate number number spacings observed expected 0 66. 67.668 1 148. 135.335 2 126. 135.335 3 92. 90.224 4 42. 45.112 5 21. 18.045 6 to INF 5. 8.282 Chisquare with 6 d.o.f. = 3.90 p-value= .310376 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean random_neum.pcm using bits 7 to 30 1.914 duplicate number number spacings observed expected 0 81. 67.668 1 141. 135.335 2 115. 135.335 3 97. 90.224 4 43. 45.112 5 16. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 6.96 p-value= .675195 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean random_neum.pcm using bits 8 to 31 1.956 duplicate number number spacings observed expected 0 78. 67.668 1 129. 135.335 2 137. 135.335 3 78. 90.224 4 54. 45.112 5 20. 18.045 6 to INF 4. 8.282 Chisquare with 6 d.o.f. = 7.73 p-value= .741254 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean random_neum.pcm using bits 9 to 32 1.844 duplicate number number spacings observed expected 0 77. 67.668 1 152. 135.335 2 136. 135.335 3 79. 90.224 4 35. 45.112 5 12. 18.045 6 to INF 9. 8.282 Chisquare with 6 d.o.f. = 9.09 p-value= .831544 ::::::::::::::::::::::::::::::::::::::::: The 9 p-values were .638931 .848068 .716026 .630299 .260275 .310376 .675195 .741254 .831544 A KSTEST for the 9 p-values yields .829636 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 random_neum.pcm For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom= 85.543; p-value= .169563 OPERM5 test for file random_neum.pcm For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom= 74.066; p-value= .028815 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 random_neum.pcm 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 215 211.4 .060688 .061 29 5122 5134.0 .028096 .089 30 23219 23103.0 .581963 .671 31 11444 11551.5 1.000864 1.672 chisquare= 1.672 for 3 d. of f.; p-value= .454758 -------------------------------------------------------------- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 random_neum.pcm 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 232 211.4 2.003699 2.004 30 5136 5134.0 .000771 2.004 31 22948 23103.0 1.040535 3.045 32 11684 11551.5 1.519261 4.564 chisquare= 4.564 for 3 d. of f.; p-value= .809694 -------------------------------------------------------------- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 random_neum.pcm Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 1 to 8 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 893 944.3 2.787 2.787 r =5 21871 21743.9 .743 3.530 r =6 77236 77311.8 .074 3.604 p=1-exp(-SUM/2)= .83506 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 2 to 9 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 931 944.3 .187 .187 r =5 21547 21743.9 1.783 1.970 r =6 77522 77311.8 .571 2.542 p=1-exp(-SUM/2)= .71943 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 3 to 10 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 887 944.3 3.477 3.477 r =5 21794 21743.9 .115 3.593 r =6 77319 77311.8 .001 3.593 p=1-exp(-SUM/2)= .83414 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 4 to 11 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 958 944.3 .199 .199 r =5 21469 21743.9 3.475 3.674 r =6 77573 77311.8 .882 4.557 p=1-exp(-SUM/2)= .89754 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 5 to 12 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 945 944.3 .001 .001 r =5 21485 21743.9 3.083 3.083 r =6 77570 77311.8 .862 3.945 p=1-exp(-SUM/2)= .86092 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 6 to 13 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 946 944.3 .003 .003 r =5 21623 21743.9 .672 .675 r =6 77431 77311.8 .184 .859 p=1-exp(-SUM/2)= .34918 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 7 to 14 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 936 944.3 .073 .073 r =5 21761 21743.9 .013 .086 r =6 77303 77311.8 .001 .087 p=1-exp(-SUM/2)= .04277 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 8 to 15 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 951 944.3 .048 .048 r =5 21865 21743.9 .674 .722 r =6 77184 77311.8 .211 .933 p=1-exp(-SUM/2)= .37288 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 9 to 16 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1015 944.3 5.293 5.293 r =5 21626 21743.9 .639 5.932 r =6 77359 77311.8 .029 5.961 p=1-exp(-SUM/2)= .94924 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 10 to 17 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 942 944.3 .006 .006 r =5 21704 21743.9 .073 .079 r =6 77354 77311.8 .023 .102 p=1-exp(-SUM/2)= .04965 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 11 to 18 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 954 944.3 .100 .100 r =5 21822 21743.9 .281 .380 r =6 77224 77311.8 .100 .480 p=1-exp(-SUM/2)= .21331 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 12 to 19 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 904 944.3 1.720 1.720 r =5 21805 21743.9 .172 1.892 r =6 77291 77311.8 .006 1.897 p=1-exp(-SUM/2)= .61273 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 13 to 20 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 964 944.3 .411 .411 r =5 21785 21743.9 .078 .489 r =6 77251 77311.8 .048 .536 p=1-exp(-SUM/2)= .23526 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 14 to 21 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 932 944.3 .160 .160 r =5 22095 21743.9 5.669 5.829 r =6 76973 77311.8 1.485 7.314 p=1-exp(-SUM/2)= .97419 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 15 to 22 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1002 944.3 3.526 3.526 r =5 21552 21743.9 1.694 5.219 r =6 77446 77311.8 .233 5.452 p=1-exp(-SUM/2)= .93452 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 16 to 23 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 947 944.3 .008 .008 r =5 21518 21743.9 2.347 2.355 r =6 77535 77311.8 .644 2.999 p=1-exp(-SUM/2)= .77676 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 17 to 24 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 955 944.3 .121 .121 r =5 21766 21743.9 .022 .144 r =6 77279 77311.8 .014 .158 p=1-exp(-SUM/2)= .07577 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 18 to 25 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 950 944.3 .034 .034 r =5 21916 21743.9 1.362 1.397 r =6 77134 77311.8 .409 1.805 p=1-exp(-SUM/2)= .59454 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 19 to 26 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 935 944.3 .092 .092 r =5 21750 21743.9 .002 .093 r =6 77315 77311.8 .000 .093 p=1-exp(-SUM/2)= .04565 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 20 to 27 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 977 944.3 1.132 1.132 r =5 21867 21743.9 .697 1.829 r =6 77156 77311.8 .314 2.143 p=1-exp(-SUM/2)= .65753 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 21 to 28 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 938 944.3 .042 .042 r =5 21787 21743.9 .085 .127 r =6 77275 77311.8 .018 .145 p=1-exp(-SUM/2)= .06993 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 22 to 29 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 964 944.3 .411 .411 r =5 21695 21743.9 .110 .521 r =6 77341 77311.8 .011 .532 p=1-exp(-SUM/2)= .23353 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 23 to 30 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 895 944.3 2.574 2.574 r =5 21807 21743.9 .183 2.757 r =6 77298 77311.8 .002 2.760 p=1-exp(-SUM/2)= .74837 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 24 to 31 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 974 944.3 .934 .934 r =5 21714 21743.9 .041 .975 r =6 77312 77311.8 .000 .975 p=1-exp(-SUM/2)= .38589 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_neum.pcm b-rank test for bits 25 to 32 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1006 944.3 4.031 4.031 r =5 21544 21743.9 1.838 5.869 r =6 77450 77311.8 .247 6.116 p=1-exp(-SUM/2)= .95302 TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices These should be 25 uniform [0,1] random variables: .835058 .719429 .834139 .897543 .860925 .349183 .042771 .372882 .949238 .049653 .213314 .612733 .235259 .974193 .934521 .776756 .075773 .594538 .045655 .657535 .069934 .233533 .748366 .385888 .953020 brank test summary for random_neum.pcm The KS test for those 25 supposed UNI's yields KS p-value= .697660 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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: 141444 missing words, -1.09 sigmas from mean, p-value= .13847 tst no 2: 141625 missing words, -.66 sigmas from mean, p-value= .25324 tst no 3: 141345 missing words, -1.32 sigmas from mean, p-value= .09366 tst no 4: 141240 missing words, -1.56 sigmas from mean, p-value= .05893 tst no 5: 141105 missing words, -1.88 sigmas from mean, p-value= .03010 tst no 6: 141679 missing words, -.54 sigmas from mean, p-value= .29524 tst no 7: 141876 missing words, -.08 sigmas from mean, p-value= .46897 tst no 8: 141350 missing words, -1.31 sigmas from mean, p-value= .09563 tst no 9: 141057 missing words, -1.99 sigmas from mean, p-value= .02322 tst no 10: 142087 missing words, .42 sigmas from mean, p-value= .66097 tst no 11: 141882 missing words, -.06 sigmas from mean, p-value= .47454 tst no 12: 141576 missing words, -.78 sigmas from mean, p-value= .21805 tst no 13: 142225 missing words, .74 sigmas from mean, p-value= .76961 tst no 14: 141718 missing words, -.45 sigmas from mean, p-value= .32743 tst no 15: 142743 missing words, 1.95 sigmas from mean, p-value= .97428 tst no 16: 141561 missing words, -.81 sigmas from mean, p-value= .20787 tst no 17: 141678 missing words, -.54 sigmas from mean, p-value= .29443 tst no 18: 142057 missing words, .35 sigmas from mean, p-value= .63496 tst no 19: 141849 missing words, -.14 sigmas from mean, p-value= .44395 tst no 20: 141433 missing words, -1.11 sigmas from mean, p-value= .13287 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 random_neum.pcm Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OPSO for random_neum.pcm using bits 23 to 32 142269 1.240 .8926 OPSO for random_neum.pcm using bits 22 to 31 142374 1.602 .9455 OPSO for random_neum.pcm using bits 21 to 30 141921 .040 .5161 OPSO for random_neum.pcm using bits 20 to 29 141764 -.501 .3081 OPSO for random_neum.pcm using bits 19 to 28 141502 -1.405 .0801 OPSO for random_neum.pcm using bits 18 to 27 141823 -.298 .3830 OPSO for random_neum.pcm using bits 17 to 26 141750 -.549 .2914 OPSO for random_neum.pcm using bits 16 to 25 141992 .285 .6122 OPSO for random_neum.pcm using bits 15 to 24 141622 -.991 .1609 OPSO for random_neum.pcm using bits 14 to 23 141982 .251 .5989 OPSO for random_neum.pcm using bits 13 to 22 142145 .813 .7918 OPSO for random_neum.pcm using bits 12 to 21 141962 .182 .5721 OPSO for random_neum.pcm using bits 11 to 20 142232 1.113 .8671 OPSO for random_neum.pcm using bits 10 to 19 141896 -.046 .4817 OPSO for random_neum.pcm using bits 9 to 18 142268 1.237 .8919 OPSO for random_neum.pcm using bits 8 to 17 141832 -.267 .3949 OPSO for random_neum.pcm using bits 7 to 16 141969 .206 .5815 OPSO for random_neum.pcm using bits 6 to 15 141964 .189 .5748 OPSO for random_neum.pcm using bits 5 to 14 141652 -.887 .1874 OPSO for random_neum.pcm using bits 4 to 13 142241 1.144 .8736 OPSO for random_neum.pcm using bits 3 to 12 142088 .616 .7311 OPSO for random_neum.pcm using bits 2 to 11 142145 .813 .7918 OPSO for random_neum.pcm using bits 1 to 10 142167 .889 .8129 OQSO test for generator random_neum.pcm Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OQSO for random_neum.pcm using bits 28 to 32 142224 1.067 .8569 OQSO for random_neum.pcm using bits 27 to 31 142151 .819 .7937 OQSO for random_neum.pcm using bits 26 to 30 141935 .087 .5347 OQSO for random_neum.pcm using bits 25 to 29 142269 1.219 .8886 OQSO for random_neum.pcm using bits 24 to 28 142061 .514 .6964 OQSO for random_neum.pcm using bits 23 to 27 141857 -.177 .4296 OQSO for random_neum.pcm using bits 22 to 26 142558 2.199 .9861 OQSO for random_neum.pcm using bits 21 to 25 141876 -.113 .4550 OQSO for random_neum.pcm using bits 20 to 24 141769 -.476 .3171 OQSO for random_neum.pcm using bits 19 to 23 141741 -.571 .2841 OQSO for random_neum.pcm using bits 18 to 22 142076 .565 .7140 OQSO for random_neum.pcm using bits 17 to 21 141874 -.120 .4523 OQSO for random_neum.pcm using bits 16 to 20 142031 .412 .6600 OQSO for random_neum.pcm using bits 15 to 19 141843 -.225 .4111 OQSO for random_neum.pcm using bits 14 to 18 142022 .382 .6487 OQSO for random_neum.pcm using bits 13 to 17 141464 -1.510 .0656 OQSO for random_neum.pcm using bits 12 to 16 141636 -.927 .1771 OQSO for random_neum.pcm using bits 11 to 15 141808 -.343 .3656 OQSO for random_neum.pcm using bits 10 to 14 141768 -.479 .3159 OQSO for random_neum.pcm using bits 9 to 13 141774 -.459 .3232 OQSO for random_neum.pcm using bits 8 to 12 141605 -1.032 .1511 OQSO for random_neum.pcm using bits 7 to 11 142394 1.643 .9498 OQSO for random_neum.pcm using bits 6 to 10 142588 2.301 .9893 OQSO for random_neum.pcm using bits 5 to 9 142074 .558 .7116 OQSO for random_neum.pcm using bits 4 to 8 141937 .094 .5374 OQSO for random_neum.pcm using bits 3 to 7 141637 -.923 .1780 OQSO for random_neum.pcm using bits 2 to 6 142144 .795 .7868 OQSO for random_neum.pcm using bits 1 to 5 142345 1.477 .9301 DNA test for generator random_neum.pcm Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p DNA for random_neum.pcm using bits 31 to 32 141724 -.547 .2923 DNA for random_neum.pcm using bits 30 to 31 141780 -.381 .3514 DNA for random_neum.pcm using bits 29 to 30 142267 1.055 .8543 DNA for random_neum.pcm using bits 28 to 29 141728 -.535 .2964 DNA for random_neum.pcm using bits 27 to 28 142011 .300 .6179 DNA for random_neum.pcm using bits 26 to 27 142636 2.144 .9840 DNA for random_neum.pcm using bits 25 to 26 141608 -.889 .1870 DNA for random_neum.pcm using bits 24 to 25 141693 -.638 .2617 DNA for random_neum.pcm using bits 23 to 24 142405 1.462 .9282 DNA for random_neum.pcm using bits 22 to 23 141497 -1.216 .1119 DNA for random_neum.pcm using bits 21 to 22 141875 -.101 .4597 DNA for random_neum.pcm using bits 20 to 21 142076 .492 .6885 DNA for random_neum.pcm using bits 19 to 20 142087 .524 .6999 DNA for random_neum.pcm using bits 18 to 19 142472 1.660 .9515 DNA for random_neum.pcm using bits 17 to 18 141716 -.570 .2842 DNA for random_neum.pcm using bits 16 to 17 141707 -.597 .2753 DNA for random_neum.pcm using bits 15 to 16 142020 .326 .6280 DNA for random_neum.pcm using bits 14 to 15 141794 -.340 .3669 DNA for random_neum.pcm using bits 13 to 14 141718 -.564 .2862 DNA for random_neum.pcm using bits 12 to 13 141552 -1.054 .1459 DNA for random_neum.pcm using bits 11 to 12 142094 .545 .7070 DNA for random_neum.pcm using bits 10 to 11 141572 -.995 .1599 DNA for random_neum.pcm using bits 9 to 10 142114 .604 .7270 DNA for random_neum.pcm using bits 8 to 9 141903 -.019 .4926 DNA for random_neum.pcm using bits 7 to 8 141470 -1.296 .0975 DNA for random_neum.pcm using bits 6 to 7 141910 .002 .5008 DNA for random_neum.pcm using bits 5 to 6 142046 .403 .6566 DNA for random_neum.pcm using bits 4 to 5 141616 -.865 .1934 DNA for random_neum.pcm using bits 3 to 4 142002 .273 .6077 DNA for random_neum.pcm using bits 2 to 3 141542 -1.084 .1393 DNA for random_neum.pcm using bits 1 to 2 142236 .964 .8324 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 random_neum.pcm 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 random_neum.pcm 2469.79 -.427 .334625 byte stream for random_neum.pcm 2371.06 -1.823 .034114 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 2482.32 -.250 .401277 bits 2 to 9 2641.16 1.996 .977048 bits 3 to 10 2428.74 -1.008 .156770 bits 4 to 11 2395.79 -1.474 .070270 bits 5 to 12 2556.75 .803 .788887 bits 6 to 13 2612.59 1.592 .944343 bits 7 to 14 2499.45 -.008 .496907 bits 8 to 15 2581.35 1.151 .875036 bits 9 to 16 2591.59 1.295 .902385 bits 10 to 17 2453.90 -.652 .257204 bits 11 to 18 2533.11 .468 .680192 bits 12 to 19 2353.43 -2.073 .019093 bits 13 to 20 2580.44 1.138 .872362 bits 14 to 21 2512.97 .183 .572750 bits 15 to 22 2467.03 -.466 .320526 bits 16 to 23 2579.50 1.124 .869558 bits 17 to 24 2399.28 -1.424 .077169 bits 18 to 25 2464.52 -.502 .307932 bits 19 to 26 2505.69 .081 .532087 bits 20 to 27 2485.04 -.212 .416239 bits 21 to 28 2540.26 .569 .715443 bits 22 to 29 2414.46 -1.210 .113187 bits 23 to 30 2610.10 1.557 .940276 bits 24 to 31 2533.09 .468 .680097 bits 25 to 32 2527.44 .388 .651019 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 random_neum.pcm Of 12,000 tries, the average no. of successes should be 3523 with sigma=21.9 Successes: 3536 z-score: .594 p-value: .723613 Successes: 3489 z-score: -1.553 p-value: .060270 Successes: 3521 z-score: -.091 p-value: .463618 Successes: 3563 z-score: 1.826 p-value: .966111 Successes: 3516 z-score: -.320 p-value: .374623 Successes: 3501 z-score: -1.005 p-value: .157553 Successes: 3559 z-score: 1.644 p-value: .949895 Successes: 3527 z-score: .183 p-value: .572463 Successes: 3502 z-score: -.959 p-value: .168804 Successes: 3539 z-score: .731 p-value: .767486 square size avg. no. parked sample sigma 100. 3525.300 23.253 KSTEST for the above 10: p= .062662 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 random_neum.pcm Sample no. d^2 avg equiv uni 5 .1170 .5952 .110978 10 .6266 .6687 .467268 15 3.3600 1.1726 .965846 20 .3280 1.2314 .280824 25 .8728 1.3343 .584043 30 .0542 1.2599 .053008 35 .8124 1.3687 .558013 40 .1722 1.2599 .158949 45 2.1677 1.2648 .886797 50 .1140 1.1815 .108248 55 .0724 1.1136 .070210 60 .4450 1.0911 .360635 65 .1412 1.0970 .132278 70 2.6878 1.1233 .932886 75 .2092 1.1579 .189621 80 1.3690 1.1651 .747370 85 2.0927 1.1417 .877938 90 .3649 1.1304 .306989 95 1.9834 1.2000 .863760 100 .7416 1.1887 .525436 MINIMUM DISTANCE TEST for random_neum.pcm Result of KS test on 20 transformed mindist^2's: p-value= .824783 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 random_neum.pcm sample no: 1 r^3= 25.427 p-value= .57154 sample no: 2 r^3= 4.851 p-value= .14930 sample no: 3 r^3= 6.465 p-value= .19387 sample no: 4 r^3= 107.266 p-value= .97200 sample no: 5 r^3= 15.842 p-value= .41026 sample no: 6 r^3= 14.712 p-value= .38761 sample no: 7 r^3= 11.740 p-value= .32386 sample no: 8 r^3= 16.846 p-value= .42967 sample no: 9 r^3= 76.981 p-value= .92316 sample no: 10 r^3= 19.757 p-value= .48241 sample no: 11 r^3= 14.147 p-value= .37598 sample no: 12 r^3= 17.966 p-value= .45056 sample no: 13 r^3= 20.122 p-value= .48867 sample no: 14 r^3= 79.401 p-value= .92911 sample no: 15 r^3= 5.389 p-value= .16442 sample no: 16 r^3= 5.308 p-value= .16216 sample no: 17 r^3= 20.841 p-value= .50077 sample no: 18 r^3= 82.404 p-value= .93587 sample no: 19 r^3= 12.190 p-value= .33392 sample no: 20 r^3= 68.509 p-value= .89809 A KS test is applied to those 20 p-values. --------------------------------------------------------- 3DSPHERES test for file random_neum.pcm p-value= .649917 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 random_neum.pcm Table of standardized frequency counts ( (obs-exp)/sqrt(exp) )^2 for j taking values <=6,7,8,...,47,>=48: -.8 .5 -.8 -.1 .1 .3 .8 .2 -.2 -.1 -.7 .7 1.0 -.8 .1 -.4 .6 .5 .0 -1.1 1.0 -.2 -.7 .3 .1 .6 -1.2 .5 -.1 .8 -1.0 -.3 -1.7 .9 -.5 -.3 -.7 .2 -1.2 .4 -.6 .0 1.8 Chi-square with 42 degrees of freedom: 21.916 z-score= -2.191 p-value= .004567 ______________________________________________________________ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 .109101 Test no. 2 p-value .646255 Test no. 3 p-value .320501 Test no. 4 p-value .407480 Test no. 5 p-value .414983 Test no. 6 p-value .280204 Test no. 7 p-value .445494 Test no. 8 p-value .026272 Test no. 9 p-value .009500 Test no. 10 p-value .491763 Results of the OSUM test for random_neum.pcm KSTEST on the above 10 p-values: .950267 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 random_neum.pcm Up and down runs in a sample of 10000 _________________________________________________ Run test for random_neum.pcm: runs up; ks test for 10 p's: .959990 runs down; ks test for 10 p's: .553549 Run test for random_neum.pcm: runs up; ks test for 10 p's: .995082 runs down; ks test for 10 p's: .716674 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 random_neum.pcm No. of wins: Observed Expected 98478 98585.86 98478= No. of wins, z-score= -.482 pvalue= .31476 Analysis of Throws-per-Game: Chisq= 15.76 for 20 degrees of freedom, p= .26884 Throws Observed Expected Chisq Sum 1 66873 66666.7 .639 .639 2 37495 37654.3 .674 1.313 3 27075 26954.7 .537 1.849 4 19243 19313.5 .257 2.106 5 13991 13851.4 1.407 3.513 6 9824 9943.5 1.437 4.950 7 7173 7145.0 .110 5.060 8 5088 5139.1 .508 5.567 9 3568 3699.9 4.700 10.267 10 2674 2666.3 .022 10.289 11 1894 1923.3 .447 10.736 12 1412 1388.7 .390 11.126 13 1005 1003.7 .002 11.128 14 724 726.1 .006 11.134 15 556 525.8 1.730 12.864 16 400 381.2 .932 13.796 17 257 276.5 1.381 15.177 18 211 200.8 .515 15.692 19 147 146.0 .007 15.699 20 107 106.2 .006 15.705 21 283 287.1 .059 15.764 SUMMARY FOR random_neum.pcm p-value for no. of wins: .314757 p-value for throws/game: .268841 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Results of DIEHARD battery of tests sent to file random_neum.txt