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_xor.pcm For a sample of size 500: mean random_xor.pcm using bits 1 to 24 2.054 duplicate number number spacings observed expected 0 67. 67.668 1 121. 135.335 2 151. 135.335 3 94. 90.224 4 37. 45.112 5 17. 18.045 6 to INF 13. 8.282 Chisquare with 6 d.o.f. = 7.70 p-value= .739347 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean random_xor.pcm using bits 2 to 25 1.856 duplicate number number spacings observed expected 0 77. 67.668 1 139. 135.335 2 144. 135.335 3 83. 90.224 4 38. 45.112 5 15. 18.045 6 to INF 4. 8.282 Chisquare with 6 d.o.f. = 6.37 p-value= .616750 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean random_xor.pcm using bits 3 to 26 2.062 duplicate number number spacings observed expected 0 63. 67.668 1 143. 135.335 2 123. 135.335 3 81. 90.224 4 60. 45.112 5 23. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 9.30 p-value= .842399 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean random_xor.pcm using bits 4 to 27 1.924 duplicate number number spacings observed expected 0 66. 67.668 1 146. 135.335 2 133. 135.335 3 100. 90.224 4 34. 45.112 5 12. 18.045 6 to INF 9. 8.282 Chisquare with 6 d.o.f. = 6.81 p-value= .660774 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean random_xor.pcm using bits 5 to 28 1.982 duplicate number number spacings observed expected 0 67. 67.668 1 128. 135.335 2 150. 135.335 3 94. 90.224 4 34. 45.112 5 21. 18.045 6 to INF 6. 8.282 Chisquare with 6 d.o.f. = 6.00 p-value= .576920 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean random_xor.pcm using bits 6 to 29 2.066 duplicate number number spacings observed expected 0 62. 67.668 1 128. 135.335 2 142. 135.335 3 88. 90.224 4 52. 45.112 5 21. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 2.99 p-value= .189833 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean random_xor.pcm using bits 7 to 30 1.994 duplicate number number spacings observed expected 0 64. 67.668 1 139. 135.335 2 138. 135.335 3 93. 90.224 4 41. 45.112 5 14. 18.045 6 to INF 11. 8.282 Chisquare with 6 d.o.f. = 2.61 p-value= .143979 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean random_xor.pcm using bits 8 to 31 1.922 duplicate number number spacings observed expected 0 70. 67.668 1 145. 135.335 2 129. 135.335 3 92. 90.224 4 43. 45.112 5 16. 18.045 6 to INF 5. 8.282 Chisquare with 6 d.o.f. = 2.73 p-value= .158483 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean random_xor.pcm using bits 9 to 32 1.922 duplicate number number spacings observed expected 0 66. 67.668 1 151. 135.335 2 133. 135.335 3 81. 90.224 4 51. 45.112 5 14. 18.045 6 to INF 4. 8.282 Chisquare with 6 d.o.f. = 6.73 p-value= .653108 ::::::::::::::::::::::::::::::::::::::::: The 9 p-values were .739347 .616750 .842399 .660774 .576920 .189833 .143979 .158483 .653108 A KSTEST for the 9 p-values yields .336153 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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_xor.pcm For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom= 90.246; p-value= .276251 OPERM5 test for file random_xor.pcm For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom= 65.905; p-value= .004272 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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_xor.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 201 211.4 .513367 .513 29 5297 5134.0 5.174446 5.688 30 23082 23103.0 .019174 5.707 31 11420 11551.5 1.497523 7.205 chisquare= 7.205 for 3 d. of f.; p-value= .937979 -------------------------------------------------------------- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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_xor.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 231 211.4 1.813725 1.814 30 5114 5134.0 .077992 1.892 31 23062 23103.0 .072927 1.965 32 11593 11551.5 .148918 2.114 chisquare= 2.114 for 3 d. of f.; p-value= .523826 -------------------------------------------------------------- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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_xor.pcm Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 1 to 8 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 926 944.3 .355 .355 r =5 21827 21743.9 .318 .672 r =6 77247 77311.8 .054 .727 p=1-exp(-SUM/2)= .30462 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 2 to 9 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 958 944.3 .199 .199 r =5 21695 21743.9 .110 .309 r =6 77347 77311.8 .016 .325 p=1-exp(-SUM/2)= .14986 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 3 to 10 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 969 944.3 .646 .646 r =5 21793 21743.9 .111 .757 r =6 77238 77311.8 .070 .827 p=1-exp(-SUM/2)= .33878 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 4 to 11 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 963 944.3 .370 .370 r =5 22081 21743.9 5.226 5.596 r =6 76956 77311.8 1.637 7.234 p=1-exp(-SUM/2)= .97314 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 5 to 12 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 971 944.3 .755 .755 r =5 21781 21743.9 .063 .818 r =6 77248 77311.8 .053 .871 p=1-exp(-SUM/2)= .35300 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 6 to 13 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 966 944.3 .499 .499 r =5 21875 21743.9 .790 1.289 r =6 77159 77311.8 .302 1.591 p=1-exp(-SUM/2)= .54866 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 7 to 14 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 894 944.3 2.679 2.679 r =5 21881 21743.9 .864 3.544 r =6 77225 77311.8 .097 3.641 p=1-exp(-SUM/2)= .83808 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 8 to 15 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 962 944.3 .332 .332 r =5 21551 21743.9 1.711 2.043 r =6 77487 77311.8 .397 2.440 p=1-exp(-SUM/2)= .70478 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 9 to 16 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 972 944.3 .812 .812 r =5 21716 21743.9 .036 .848 r =6 77312 77311.8 .000 .848 p=1-exp(-SUM/2)= .34567 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 10 to 17 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 986 944.3 1.841 1.841 r =5 21769 21743.9 .029 1.870 r =6 77245 77311.8 .058 1.928 p=1-exp(-SUM/2)= .61864 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 11 to 18 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 927 944.3 .317 .317 r =5 21797 21743.9 .130 .447 r =6 77276 77311.8 .017 .463 p=1-exp(-SUM/2)= .20675 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 12 to 19 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 886 944.3 3.600 3.600 r =5 21795 21743.9 .120 3.720 r =6 77319 77311.8 .001 3.720 p=1-exp(-SUM/2)= .84435 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 13 to 20 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 915 944.3 .909 .909 r =5 21909 21743.9 1.254 2.163 r =6 77176 77311.8 .239 2.401 p=1-exp(-SUM/2)= .69901 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 14 to 21 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 977 944.3 1.132 1.132 r =5 21801 21743.9 .150 1.282 r =6 77222 77311.8 .104 1.387 p=1-exp(-SUM/2)= .50006 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 15 to 22 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1035 944.3 8.711 8.711 r =5 21744 21743.9 .000 8.711 r =6 77221 77311.8 .107 8.818 p=1-exp(-SUM/2)= .98783 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 16 to 23 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 985 944.3 1.754 1.754 r =5 21857 21743.9 .588 2.342 r =6 77158 77311.8 .306 2.648 p=1-exp(-SUM/2)= .73398 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 17 to 24 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 988 944.3 2.022 2.022 r =5 21803 21743.9 .161 2.183 r =6 77209 77311.8 .137 2.320 p=1-exp(-SUM/2)= .68644 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 18 to 25 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1018 944.3 5.752 5.752 r =5 21789 21743.9 .094 5.845 r =6 77193 77311.8 .183 6.028 p=1-exp(-SUM/2)= .95090 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 19 to 26 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 920 944.3 .625 .625 r =5 21778 21743.9 .053 .679 r =6 77302 77311.8 .001 .680 p=1-exp(-SUM/2)= .28827 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 20 to 27 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 959 944.3 .229 .229 r =5 21680 21743.9 .188 .417 r =6 77361 77311.8 .031 .448 p=1-exp(-SUM/2)= .20064 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 21 to 28 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 980 944.3 1.350 1.350 r =5 21885 21743.9 .916 2.265 r =6 77135 77311.8 .404 2.670 p=1-exp(-SUM/2)= .73678 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 22 to 29 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 956 944.3 .145 .145 r =5 21845 21743.9 .470 .615 r =6 77199 77311.8 .165 .780 p=1-exp(-SUM/2)= .32281 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 23 to 30 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 941 944.3 .012 .012 r =5 21706 21743.9 .066 .078 r =6 77353 77311.8 .022 .100 p=1-exp(-SUM/2)= .04856 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 24 to 31 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 942 944.3 .006 .006 r =5 21847 21743.9 .489 .494 r =6 77211 77311.8 .131 .626 p=1-exp(-SUM/2)= .26871 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG random_xor.pcm b-rank test for bits 25 to 32 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 998 944.3 3.054 3.054 r =5 21595 21743.9 1.020 4.073 r =6 77407 77311.8 .117 4.191 p=1-exp(-SUM/2)= .87696 TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices These should be 25 uniform [0,1] random variables: .304622 .149865 .338780 .973135 .353002 .548657 .838085 .704776 .345666 .618644 .206754 .844350 .699008 .500060 .987833 .733977 .686443 .950905 .288267 .200641 .736779 .322806 .048558 .268712 .876961 brank test summary for random_xor.pcm The KS test for those 25 supposed UNI's yields KS p-value= .342554 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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: 141849 missing words, -.14 sigmas from mean, p-value= .44395 tst no 2: 141830 missing words, -.19 sigmas from mean, p-value= .42648 tst no 3: 141978 missing words, .16 sigmas from mean, p-value= .56374 tst no 4: 141758 missing words, -.35 sigmas from mean, p-value= .36183 tst no 5: 142165 missing words, .60 sigmas from mean, p-value= .72487 tst no 6: 141976 missing words, .16 sigmas from mean, p-value= .56189 tst no 7: 141705 missing words, -.48 sigmas from mean, p-value= .31654 tst no 8: 142583 missing words, 1.57 sigmas from mean, p-value= .94226 tst no 9: 142567 missing words, 1.54 sigmas from mean, p-value= .93781 tst no 10: 143170 missing words, 2.95 sigmas from mean, p-value= .99839 tst no 11: 142139 missing words, .54 sigmas from mean, p-value= .70423 tst no 12: 141706 missing words, -.48 sigmas from mean, p-value= .31737 tst no 13: 141178 missing words, -1.71 sigmas from mean, p-value= .04375 tst no 14: 142019 missing words, .26 sigmas from mean, p-value= .60112 tst no 15: 141753 missing words, -.37 sigmas from mean, p-value= .35746 tst no 16: 141915 missing words, .01 sigmas from mean, p-value= .50529 tst no 17: 141826 missing words, -.19 sigmas from mean, p-value= .42282 tst no 18: 141902 missing words, -.02 sigmas from mean, p-value= .49317 tst no 19: 141585 missing words, -.76 sigmas from mean, p-value= .22429 tst no 20: 142583 missing words, 1.57 sigmas from mean, p-value= .94226 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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_xor.pcm Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OPSO for random_xor.pcm using bits 23 to 32 141934 .085 .5339 OPSO for random_xor.pcm using bits 22 to 31 141770 -.480 .3155 OPSO for random_xor.pcm using bits 21 to 30 142344 1.499 .9330 OPSO for random_xor.pcm using bits 20 to 29 142027 .406 .6575 OPSO for random_xor.pcm using bits 19 to 28 142219 1.068 .8572 OPSO for random_xor.pcm using bits 18 to 27 141728 -.625 .2659 OPSO for random_xor.pcm using bits 17 to 26 142035 .433 .6676 OPSO for random_xor.pcm using bits 16 to 25 141948 .133 .5530 OPSO for random_xor.pcm using bits 15 to 24 142335 1.468 .9289 OPSO for random_xor.pcm using bits 14 to 23 142085 .606 .7277 OPSO for random_xor.pcm using bits 13 to 22 141885 -.084 .4666 OPSO for random_xor.pcm using bits 12 to 21 141868 -.143 .4433 OPSO for random_xor.pcm using bits 11 to 20 141875 -.118 .4529 OPSO for random_xor.pcm using bits 10 to 19 142562 2.251 .9878 OPSO for random_xor.pcm using bits 9 to 18 141257 -2.249 .0122 OPSO for random_xor.pcm using bits 8 to 17 141623 -.987 .1617 OPSO for random_xor.pcm using bits 7 to 16 141844 -.225 .4109 OPSO for random_xor.pcm using bits 6 to 15 142344 1.499 .9330 OPSO for random_xor.pcm using bits 5 to 14 142125 .744 .7715 OPSO for random_xor.pcm using bits 4 to 13 142148 .823 .7947 OPSO for random_xor.pcm using bits 3 to 12 141872 -.129 .4488 OPSO for random_xor.pcm using bits 2 to 11 141959 .171 .5680 OPSO for random_xor.pcm using bits 1 to 10 142062 .526 .7007 OQSO test for generator random_xor.pcm Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OQSO for random_xor.pcm using bits 28 to 32 141696 -.723 .2348 OQSO for random_xor.pcm using bits 27 to 31 141739 -.577 .2818 OQSO for random_xor.pcm using bits 26 to 30 142469 1.897 .9711 OQSO for random_xor.pcm using bits 25 to 29 141672 -.805 .2106 OQSO for random_xor.pcm using bits 24 to 28 141787 -.415 .3392 OQSO for random_xor.pcm using bits 23 to 27 141910 .002 .5009 OQSO for random_xor.pcm using bits 22 to 26 142031 .412 .6600 OQSO for random_xor.pcm using bits 21 to 25 141470 -1.489 .0682 OQSO for random_xor.pcm using bits 20 to 24 141950 .138 .5548 OQSO for random_xor.pcm using bits 19 to 23 141922 .043 .5171 OQSO for random_xor.pcm using bits 18 to 22 141545 -1.235 .1084 OQSO for random_xor.pcm using bits 17 to 21 141380 -1.794 .0364 OQSO for random_xor.pcm using bits 16 to 20 142026 .395 .6538 OQSO for random_xor.pcm using bits 15 to 19 142577 2.263 .9882 OQSO for random_xor.pcm using bits 14 to 18 141922 .043 .5171 OQSO for random_xor.pcm using bits 13 to 17 141765 -.489 .3123 OQSO for random_xor.pcm using bits 12 to 16 141392 -1.754 .0397 OQSO for random_xor.pcm using bits 11 to 15 141753 -.530 .2981 OQSO for random_xor.pcm using bits 10 to 14 141413 -1.682 .0462 OQSO for random_xor.pcm using bits 9 to 13 142029 .406 .6575 OQSO for random_xor.pcm using bits 8 to 12 141975 .223 .5881 OQSO for random_xor.pcm using bits 7 to 11 141753 -.530 .2981 OQSO for random_xor.pcm using bits 6 to 10 141816 -.316 .3759 OQSO for random_xor.pcm using bits 5 to 9 141981 .243 .5960 OQSO for random_xor.pcm using bits 4 to 8 141815 -.320 .3746 OQSO for random_xor.pcm using bits 3 to 7 142168 .877 .8097 OQSO for random_xor.pcm using bits 2 to 6 142399 1.660 .9515 OQSO for random_xor.pcm using bits 1 to 5 141886 -.079 .4685 DNA test for generator random_xor.pcm Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p DNA for random_xor.pcm using bits 31 to 32 141638 -.800 .2117 DNA for random_xor.pcm using bits 30 to 31 141882 -.081 .4679 DNA for random_xor.pcm using bits 29 to 30 142045 .400 .6555 DNA for random_xor.pcm using bits 28 to 29 141529 -1.122 .1309 DNA for random_xor.pcm using bits 27 to 28 141877 -.095 .4620 DNA for random_xor.pcm using bits 26 to 27 141644 -.783 .2169 DNA for random_xor.pcm using bits 25 to 26 141923 .040 .5161 DNA for random_xor.pcm using bits 24 to 25 141808 -.299 .3825 DNA for random_xor.pcm using bits 23 to 24 141673 -.697 .2429 DNA for random_xor.pcm using bits 22 to 23 142200 .857 .8044 DNA for random_xor.pcm using bits 21 to 22 142110 .592 .7231 DNA for random_xor.pcm using bits 20 to 21 142194 .840 .7995 DNA for random_xor.pcm using bits 19 to 20 141171 -2.178 .0147 DNA for random_xor.pcm using bits 18 to 19 141852 -.169 .4329 DNA for random_xor.pcm using bits 17 to 18 142657 2.206 .9863 DNA for random_xor.pcm using bits 16 to 17 141901 -.025 .4902 DNA for random_xor.pcm using bits 15 to 16 141491 -1.234 .1086 DNA for random_xor.pcm using bits 14 to 15 141983 .217 .5860 DNA for random_xor.pcm using bits 13 to 14 142087 .524 .6999 DNA for random_xor.pcm using bits 12 to 13 141574 -.989 .1613 DNA for random_xor.pcm using bits 11 to 12 141697 -.626 .2655 DNA for random_xor.pcm using bits 10 to 11 141136 -2.281 .0113 DNA for random_xor.pcm using bits 9 to 10 141827 -.243 .4041 DNA for random_xor.pcm using bits 8 to 9 141947 .111 .5442 DNA for random_xor.pcm using bits 7 to 8 142122 .627 .7348 DNA for random_xor.pcm using bits 6 to 7 142192 .834 .7978 DNA for random_xor.pcm using bits 5 to 6 142109 .589 .7221 DNA for random_xor.pcm using bits 4 to 5 142003 .276 .6088 DNA for random_xor.pcm using bits 3 to 4 142083 .512 .6958 DNA for random_xor.pcm using bits 2 to 3 142428 1.530 .9370 DNA for random_xor.pcm using bits 1 to 2 141988 .232 .5918 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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_xor.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_xor.pcm 2341.39 -2.243 .012446 byte stream for random_xor.pcm 2431.56 -.968 .166562 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 2360.89 -1.967 .024570 bits 2 to 9 2586.32 1.221 .888904 bits 3 to 10 2527.54 .390 .651553 bits 4 to 11 2631.79 1.864 .968827 bits 5 to 12 2479.59 -.289 .386414 bits 6 to 13 2422.31 -1.099 .135948 bits 7 to 14 2443.34 -.801 .211471 bits 8 to 15 2413.31 -1.226 .110093 bits 9 to 16 2404.57 -1.350 .088580 bits 10 to 17 2425.92 -1.048 .147400 bits 11 to 18 2610.41 1.561 .940785 bits 12 to 19 2547.79 .676 .750453 bits 13 to 20 2500.78 .011 .504407 bits 14 to 21 2424.17 -1.072 .141766 bits 15 to 22 2546.99 .665 .746815 bits 16 to 23 2534.56 .489 .687480 bits 17 to 24 2443.26 -.802 .211155 bits 18 to 25 2375.92 -1.755 .039645 bits 19 to 26 2484.05 -.226 .410791 bits 20 to 27 2561.22 .866 .806697 bits 21 to 28 2545.01 .636 .737774 bits 22 to 29 2562.55 .885 .811825 bits 23 to 30 2498.43 -.022 .491121 bits 24 to 31 2602.41 1.448 .926223 bits 25 to 32 2557.02 .806 .790002 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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_xor.pcm Of 12,000 tries, the average no. of successes should be 3523 with sigma=21.9 Successes: 3498 z-score: -1.142 p-value: .126820 Successes: 3544 z-score: .959 p-value: .831196 Successes: 3500 z-score: -1.050 p-value: .146807 Successes: 3544 z-score: .959 p-value: .831196 Successes: 3554 z-score: 1.416 p-value: .921543 Successes: 3530 z-score: .320 p-value: .625377 Successes: 3526 z-score: .137 p-value: .554479 Successes: 3538 z-score: .685 p-value: .753306 Successes: 3541 z-score: .822 p-value: .794438 Successes: 3518 z-score: -.228 p-value: .409702 square size avg. no. parked sample sigma 100. 3529.300 17.975 KSTEST for the above 10: p= .595175 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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_xor.pcm Sample no. d^2 avg equiv uni 5 2.2688 .8296 .897738 10 .8495 .7374 .574186 15 1.3640 .8170 .746109 20 .6367 .7265 .472646 25 .8116 .8301 .557654 30 .0204 .8189 .020326 35 .8969 .8992 .594015 40 3.4906 .9939 .970048 45 4.4677 1.0972 .988781 50 .2547 1.0877 .225865 55 3.3022 1.1043 .963804 60 .4597 1.1293 .369961 65 .8387 1.1109 .569563 70 .1441 1.1072 .134788 75 .7229 1.0906 .516395 80 1.4316 1.0733 .762777 85 2.1090 1.0733 .879916 90 .0223 1.0597 .022165 95 .7523 1.0279 .530510 100 .5594 1.0161 .430026 MINIMUM DISTANCE TEST for random_xor.pcm Result of KS test on 20 transformed mindist^2's: p-value= .245498 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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_xor.pcm sample no: 1 r^3= 14.118 p-value= .37537 sample no: 2 r^3= 14.412 p-value= .38147 sample no: 3 r^3= 36.581 p-value= .70458 sample no: 4 r^3= .329 p-value= .01091 sample no: 5 r^3= 2.720 p-value= .08667 sample no: 6 r^3= 8.297 p-value= .24161 sample no: 7 r^3= 17.922 p-value= .44976 sample no: 8 r^3= .077 p-value= .00258 sample no: 9 r^3= 20.595 p-value= .49666 sample no: 10 r^3= 43.475 p-value= .76523 sample no: 11 r^3= 58.310 p-value= .85682 sample no: 12 r^3= 64.156 p-value= .88217 sample no: 13 r^3= 22.310 p-value= .52464 sample no: 14 r^3= 8.171 p-value= .23842 sample no: 15 r^3= 34.223 p-value= .68043 sample no: 16 r^3= 8.354 p-value= .24305 sample no: 17 r^3= 38.310 p-value= .72112 sample no: 18 r^3= 3.017 p-value= .09566 sample no: 19 r^3= 32.863 p-value= .66561 sample no: 20 r^3= 69.470 p-value= .90130 A KS test is applied to those 20 p-values. --------------------------------------------------------- 3DSPHERES test for file random_xor.pcm p-value= .326342 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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_xor.pcm Table of standardized frequency counts ( (obs-exp)/sqrt(exp) )^2 for j taking values <=6,7,8,...,47,>=48: -.1 .9 1.5 .5 .9 .5 .3 .4 -.3 .4 1.7 .5 1.1 1.5 .9 1.5 -1.8 .0 -1.2 -1.0 .4 .1 -1.1 .1 -2.3 -.8 -1.4 -1.5 .6 .8 .3 -.7 -.3 .0 1.3 .1 .7 1.1 1.3 .4 .9 -1.0 -.1 Chi-square with 42 degrees of freedom: 40.688 z-score= -.143 p-value= .471343 ______________________________________________________________ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 .077089 Test no. 2 p-value .044854 Test no. 3 p-value .898460 Test no. 4 p-value .569820 Test no. 5 p-value .361928 Test no. 6 p-value .129282 Test no. 7 p-value .987754 Test no. 8 p-value .891360 Test no. 9 p-value .178251 Test no. 10 p-value .839166 Results of the OSUM test for random_xor.pcm KSTEST on the above 10 p-values: .588272 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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_xor.pcm Up and down runs in a sample of 10000 _________________________________________________ Run test for random_xor.pcm : runs up; ks test for 10 p's: .222855 runs down; ks test for 10 p's: .471243 Run test for random_xor.pcm : runs up; ks test for 10 p's: .315527 runs down; ks test for 10 p's: .328399 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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_xor.pcm No. of wins: Observed Expected 98446 98585.86 98446= No. of wins, z-score= -.626 pvalue= .26581 Analysis of Throws-per-Game: Chisq= 13.98 for 20 degrees of freedom, p= .16834 Throws Observed Expected Chisq Sum 1 66563 66666.7 .161 .161 2 37806 37654.3 .611 .772 3 26857 26954.7 .354 1.127 4 19364 19313.5 .132 1.259 5 13934 13851.4 .492 1.751 6 9921 9943.5 .051 1.802 7 7170 7145.0 .087 1.890 8 5143 5139.1 .003 1.893 9 3679 3699.9 .118 2.010 10 2679 2666.3 .061 2.071 11 1880 1923.3 .976 3.047 12 1350 1388.7 1.081 4.128 13 982 1003.7 .470 4.597 14 769 726.1 2.530 7.127 15 515 525.8 .223 7.350 16 375 381.2 .099 7.450 17 269 276.5 .206 7.655 18 175 200.8 3.322 10.977 19 166 146.0 2.744 13.722 20 110 106.2 .135 13.856 21 293 287.1 .121 13.977 SUMMARY FOR random_xor.pcm p-value for no. of wins: .265811 p-value for throws/game: .168340 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Results of DIEHARD battery of tests sent to file random_xor.txt