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 invcong.32 For a sample of size 500: mean invcong.32 using bits 1 to 24 1.902 duplicate number number spacings observed expected 0 69. 67.668 1 143. 135.335 2 146. 135.335 3 80. 90.224 4 45. 45.112 5 7. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = 9.58 p-value= .856325 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean invcong.32 using bits 2 to 25 2.024 duplicate number number spacings observed expected 0 60. 67.668 1 128. 135.335 2 146. 135.335 3 102. 90.224 4 43. 45.112 5 13. 18.045 6 to INF 8. 8.282 Chisquare with 6 d.o.f. = 5.16 p-value= .476883 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean invcong.32 using bits 3 to 26 1.976 duplicate number number spacings observed expected 0 74. 67.668 1 141. 135.335 2 129. 135.335 3 82. 90.224 4 49. 45.112 5 12. 18.045 6 to INF 13. 8.282 Chisquare with 6 d.o.f. = 6.92 p-value= .672048 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean invcong.32 using bits 4 to 27 1.950 duplicate number number spacings observed expected 0 74. 67.668 1 131. 135.335 2 143. 135.335 3 84. 90.224 4 39. 45.112 5 24. 18.045 6 to INF 5. 8.282 Chisquare with 6 d.o.f. = 5.69 p-value= .541058 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean invcong.32 using bits 5 to 28 1.932 duplicate number number spacings observed expected 0 64. 67.668 1 141. 135.335 2 151. 135.335 3 82. 90.224 4 42. 45.112 5 13. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 4.82 p-value= .433157 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean invcong.32 using bits 6 to 29 2.082 duplicate number number spacings observed expected 0 64. 67.668 1 148. 135.335 2 120. 135.335 3 82. 90.224 4 45. 45.112 5 27. 18.045 6 to INF 14. 8.282 Chisquare with 6 d.o.f. = 12.26 p-value= .943668 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean invcong.32 using bits 7 to 30 2.156 duplicate number number spacings observed expected 0 67. 67.668 1 126. 135.335 2 123. 135.335 3 90. 90.224 4 55. 45.112 5 24. 18.045 6 to INF 15. 8.282 Chisquare with 6 d.o.f. = 11.36 p-value= .922079 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean invcong.32 using bits 8 to 31 2.064 duplicate number number spacings observed expected 0 72. 67.668 1 126. 135.335 2 119. 135.335 3 102. 90.224 4 51. 45.112 5 22. 18.045 6 to INF 8. 8.282 Chisquare with 6 d.o.f. = 6.08 p-value= .585190 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean invcong.32 using bits 9 to 32 2.120 duplicate number number spacings observed expected 0 74. 67.668 1 113. 135.335 2 145. 135.335 3 82. 90.224 4 45. 45.112 5 27. 18.045 6 to INF 14. 8.282 Chisquare with 6 d.o.f. = 14.11 p-value= .971582 ::::::::::::::::::::::::::::::::::::::::: The 9 p-values were .856325 .476883 .672048 .541058 .433157 .943668 .922079 .585190 .971582 A KSTEST for the 9 p-values yields .961108 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 invcong.32 For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom= 91.434; p-value= .306910 OPERM5 test for file invcong.32 For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=131.517; p-value= .983954 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 invcong.32 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 225 211.4 .872538 .873 29 5171 5134.0 .266505 1.139 30 23045 23103.0 .145844 1.285 31 11559 11551.5 .004838 1.290 chisquare= 1.290 for 3 d. of f.; p-value= .396475 -------------------------------------------------------------- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 invcong.32 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 208 211.4 .055259 .055 30 5105 5134.0 .163925 .219 31 23123 23103.0 .017233 .236 32 11564 11551.5 .013474 .250 chisquare= .250 for 3 d. of f.; p-value= .339417 -------------------------------------------------------------- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 invcong.32 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 1 to 8 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 929 944.3 .248 .248 r =5 21947 21743.9 1.897 2.145 r =6 77124 77311.8 .456 2.601 p=1-exp(-SUM/2)= .72763 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 2 to 9 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 951 944.3 .048 .048 r =5 21909 21743.9 1.254 1.301 r =6 77140 77311.8 .382 1.683 p=1-exp(-SUM/2)= .56891 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 3 to 10 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 981 944.3 1.426 1.426 r =5 21864 21743.9 .663 2.090 r =6 77155 77311.8 .318 2.408 p=1-exp(-SUM/2)= .69995 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 4 to 11 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 945 944.3 .001 .001 r =5 21960 21743.9 2.148 2.148 r =6 77095 77311.8 .608 2.756 p=1-exp(-SUM/2)= .74794 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 5 to 12 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 935 944.3 .092 .092 r =5 21796 21743.9 .125 .216 r =6 77269 77311.8 .024 .240 p=1-exp(-SUM/2)= .11315 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 6 to 13 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 977 944.3 1.132 1.132 r =5 21925 21743.9 1.508 2.641 r =6 77098 77311.8 .591 3.232 p=1-exp(-SUM/2)= .80130 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 7 to 14 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 986 944.3 1.841 1.841 r =5 21911 21743.9 1.284 3.125 r =6 77103 77311.8 .564 3.689 p=1-exp(-SUM/2)= .84193 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 8 to 15 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 967 944.3 .546 .546 r =5 21896 21743.9 1.064 1.610 r =6 77137 77311.8 .395 2.005 p=1-exp(-SUM/2)= .63300 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 9 to 16 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1016 944.3 5.444 5.444 r =5 22020 21743.9 3.506 8.950 r =6 76964 77311.8 1.565 10.514 p=1-exp(-SUM/2)= .99479 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 10 to 17 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1019 944.3 5.909 5.909 r =5 22188 21743.9 9.070 14.979 r =6 76793 77311.8 3.481 18.461 p=1-exp(-SUM/2)= .99990 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 11 to 18 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1015 944.3 5.293 5.293 r =5 22114 21743.9 6.299 11.593 r =6 76871 77311.8 2.513 14.106 p=1-exp(-SUM/2)= .99914 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 12 to 19 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1095 944.3 24.050 24.050 r =5 22530 21743.9 28.420 52.469 r =6 76375 77311.8 11.351 63.821 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 13 to 20 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1091 944.3 22.790 22.790 r =5 22621 21743.9 35.380 58.170 r =6 76288 77311.8 13.558 71.728 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 14 to 21 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1154 944.3 46.567 46.567 r =5 22602 21743.9 33.864 80.431 r =6 76244 77311.8 14.748 95.179 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 15 to 22 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1124 944.3 34.196 34.196 r =5 22282 21743.9 13.316 47.513 r =6 76594 77311.8 6.664 54.177 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 16 to 23 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1254 944.3 101.571 101.571 r =5 22949 21743.9 66.790 168.360 r =6 75797 77311.8 29.680 198.040 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 17 to 24 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1452 944.3 272.962 272.962 r =5 22489 21743.9 25.532 298.494 r =6 76059 77311.8 20.301 318.795 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 18 to 25 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1575 944.3 421.244 421.244 r =5 23773 21743.9 189.352 610.595 r =6 74652 77311.8 91.507 702.102 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 19 to 26 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1857 944.3 882.154 882.154 r =5 24971 21743.9 478.947 1361.101 r =6 73172 77311.8 221.674 1582.774 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 20 to 27 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1986 944.3 1149.142 1149.142 r =5 22156 21743.9 7.810 1156.952 r =6 75858 77311.8 27.338 1184.290 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 21 to 28 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1706 944.3 614.407 614.407 r =5 22498 21743.9 26.153 640.560 r =6 75796 77311.8 29.719 670.279 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 22 to 29 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1269 944.3 111.648 111.648 r =5 17094 21743.9 994.374 1106.022 r =6 81637 77311.8 241.972 1347.994 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 23 to 30 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1562 944.3 404.057 404.057 r =5 17973 21743.9 653.962 1058.019 r =6 80465 77311.8 128.604 1186.624 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 24 to 31 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 2735 944.3 3395.740 3395.740 r =5 16796 21743.9 1125.912 4521.652 r =6 80469 77311.8 128.931 4650.583 p=1-exp(-SUM/2)=1.00000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG invcong.32 b-rank test for bits 25 to 32 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 781 944.3 28.240 28.240 r =5 13283 21743.9 3292.272 3320.512 r =6 85936 77311.8 962.036 4282.548 p=1-exp(-SUM/2)=1.00000 TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices These should be 25 uniform [0,1] random variables: .727633 .568914 .699952 .747941 .113146 .801296 .841930 .633004 .994790 .999902 .999135 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 brank test summary for invcong.32 The KS test for those 25 supposed UNI's yields KS p-value=1.000000 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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: 140177 missing words, -4.05 sigmas from mean, p-value= .00003 tst no 2: 140005 missing words, -4.45 sigmas from mean, p-value= .00000 tst no 3: 139649 missing words, -5.28 sigmas from mean, p-value= .00000 tst no 4: 139561 missing words, -5.49 sigmas from mean, p-value= .00000 tst no 5: 140210 missing words, -3.97 sigmas from mean, p-value= .00004 tst no 6: 139963 missing words, -4.55 sigmas from mean, p-value= .00000 tst no 7: 139862 missing words, -4.78 sigmas from mean, p-value= .00000 tst no 8: 139237 missing words, -6.24 sigmas from mean, p-value= .00000 tst no 9: 139271 missing words, -6.16 sigmas from mean, p-value= .00000 tst no 10: 139059 missing words, -6.66 sigmas from mean, p-value= .00000 tst no 11: 139659 missing words, -5.26 sigmas from mean, p-value= .00000 tst no 12: 139806 missing words, -4.91 sigmas from mean, p-value= .00000 tst no 13: 140058 missing words, -4.33 sigmas from mean, p-value= .00001 tst no 14: 139651 missing words, -5.28 sigmas from mean, p-value= .00000 tst no 15: 140352 missing words, -3.64 sigmas from mean, p-value= .00014 tst no 16: 140327 missing words, -3.70 sigmas from mean, p-value= .00011 tst no 17: 139666 missing words, -5.24 sigmas from mean, p-value= .00000 tst no 18: 140508 missing words, -3.27 sigmas from mean, p-value= .00053 tst no 19: 140125 missing words, -4.17 sigmas from mean, p-value= .00002 tst no 20: 139666 missing words, -5.24 sigmas from mean, p-value= .00000 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 invcong.32 Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OPSO for invcong.32 using bits 23 to 32 1047552******* 1.0000 OPSO for invcong.32 using bits 22 to 31 1046528******* 1.0000 OPSO for invcong.32 using bits 21 to 30 1044480******* 1.0000 OPSO for invcong.32 using bits 20 to 29 1040394******* 1.0000 OPSO for invcong.32 using bits 19 to 28 1032682******* 1.0000 OPSO for invcong.32 using bits 18 to 27 1017186******* 1.0000 OPSO for invcong.32 using bits 17 to 26 987210******* 1.0000 OPSO for invcong.32 using bits 16 to 25 928242******* 1.0000 OPSO for invcong.32 using bits 15 to 24 820114******* 1.0000 OPSO for invcong.32 using bits 14 to 23 641010******* 1.0000 OPSO for invcong.32 using bits 13 to 22 395756875.333 1.0000 OPSO for invcong.32 using bits 12 to 21 146538 15.961 1.0000 OPSO for invcong.32 using bits 11 to 20 145177 11.268 1.0000 OPSO for invcong.32 using bits 10 to 19 143137 4.233 1.0000 OPSO for invcong.32 using bits 9 to 18 142221 1.075 .8588 OPSO for invcong.32 using bits 8 to 17 142286 1.299 .9030 OPSO for invcong.32 using bits 7 to 16 142152 .837 .7986 OPSO for invcong.32 using bits 6 to 15 142076 .575 .7173 OPSO for invcong.32 using bits 5 to 14 142634 2.499 .9938 OPSO for invcong.32 using bits 4 to 13 142465 1.916 .9723 OPSO for invcong.32 using bits 3 to 12 142575 2.295 .9891 OPSO for invcong.32 using bits 2 to 11 142172 .906 .8175 OPSO for invcong.32 using bits 1 to 10 142331 1.454 .9270 OQSO test for generator invcong.32 Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OQSO for invcong.32 using bits 28 to 32 1048544******* 1.0000 OQSO for invcong.32 using bits 27 to 31 1048512******* 1.0000 OQSO for invcong.32 using bits 26 to 30 1048448******* 1.0000 OQSO for invcong.32 using bits 25 to 29 1048320******* 1.0000 OQSO for invcong.32 using bits 24 to 28 1048064******* 1.0000 OQSO for invcong.32 using bits 23 to 27 1047552******* 1.0000 OQSO for invcong.32 using bits 22 to 26 1046536******* 1.0000 OQSO for invcong.32 using bits 21 to 25 1044504******* 1.0000 OQSO for invcong.32 using bits 20 to 24 1040400******* 1.0000 OQSO for invcong.32 using bits 19 to 23 1032336******* 1.0000 OQSO for invcong.32 using bits 18 to 22 1016328******* 1.0000 OQSO for invcong.32 using bits 17 to 21 985140******* 1.0000 OQSO for invcong.32 using bits 16 to 20 926058******* 1.0000 OQSO for invcong.32 using bits 15 to 19 818620******* 1.0000 OQSO for invcong.32 using bits 14 to 18 637338******* 1.0000 OQSO for invcong.32 using bits 13 to 17 388698836.572 1.0000 OQSO for invcong.32 using bits 12 to 16 141696 -.723 .2348 OQSO for invcong.32 using bits 11 to 15 141882 -.093 .4631 OQSO for invcong.32 using bits 10 to 14 142773 2.928 .9983 OQSO for invcong.32 using bits 9 to 13 141757 -.516 .3028 OQSO for invcong.32 using bits 8 to 12 142274 1.236 .8918 OQSO for invcong.32 using bits 7 to 11 141944 .118 .5468 OQSO for invcong.32 using bits 6 to 10 142158 .843 .8004 OQSO for invcong.32 using bits 5 to 9 141667 -.821 .2057 OQSO for invcong.32 using bits 4 to 8 142052 .484 .6857 OQSO for invcong.32 using bits 3 to 7 141865 -.150 .4403 OQSO for invcong.32 using bits 2 to 6 142273 1.233 .8912 OQSO for invcong.32 using bits 1 to 5 142308 1.351 .9117 DNA test for generator invcong.32 Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p DNA for invcong.32 using bits 31 to 32 1048572******* 1.0000 DNA for invcong.32 using bits 30 to 31 1048568******* 1.0000 DNA for invcong.32 using bits 29 to 30 1048560******* 1.0000 DNA for invcong.32 using bits 28 to 29 1048544******* 1.0000 DNA for invcong.32 using bits 27 to 28 1048512******* 1.0000 DNA for invcong.32 using bits 26 to 27 1048448******* 1.0000 DNA for invcong.32 using bits 25 to 26 1048320******* 1.0000 DNA for invcong.32 using bits 24 to 25 1048064******* 1.0000 DNA for invcong.32 using bits 23 to 24 1047554******* 1.0000 DNA for invcong.32 using bits 22 to 23 1046548******* 1.0000 DNA for invcong.32 using bits 21 to 22 1044484******* 1.0000 DNA for invcong.32 using bits 20 to 21 1040460******* 1.0000 DNA for invcong.32 using bits 19 to 20 1032432******* 1.0000 DNA for invcong.32 using bits 18 to 19 1016400******* 1.0000 DNA for invcong.32 using bits 17 to 18 985152******* 1.0000 DNA for invcong.32 using bits 16 to 17 925244******* 1.0000 DNA for invcong.32 using bits 15 to 16 817826******* 1.0000 DNA for invcong.32 using bits 14 to 15 636864******* 1.0000 DNA for invcong.32 using bits 13 to 14 386588721.766 1.0000 DNA for invcong.32 using bits 12 to 13 143460 4.574 1.0000 DNA for invcong.32 using bits 11 to 12 142150 .710 .7611 DNA for invcong.32 using bits 10 to 11 141598 -.918 .1792 DNA for invcong.32 using bits 9 to 10 141750 -.470 .3192 DNA for invcong.32 using bits 8 to 9 141564 -1.019 .1542 DNA for invcong.32 using bits 7 to 8 142000 .267 .6054 DNA for invcong.32 using bits 6 to 7 142106 .580 .7191 DNA for invcong.32 using bits 5 to 6 141767 -.420 .3373 DNA for invcong.32 using bits 4 to 5 141998 .262 .6032 DNA for invcong.32 using bits 3 to 4 142037 .377 .6468 DNA for invcong.32 using bits 2 to 3 141395 -1.517 .0646 DNA for invcong.32 using bits 1 to 2 142288 1.117 .8680 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 invcong.32 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 invcong.32 14499.48 169.698 1.000000 byte stream for invcong.32 14744.00 173.156 1.000000 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 2519.05 .269 .606213 bits 2 to 9 2537.62 .532 .702664 bits 3 to 10 2528.81 .407 .658157 bits 4 to 11 2467.62 -.458 .323522 bits 5 to 12 2591.27 1.291 .901594 bits 6 to 13 2607.15 1.515 .935151 bits 7 to 14 2580.03 1.132 .871131 bits 8 to 15 2539.88 .564 .713607 bits 9 to 16 2448.03 -.735 .231184 bits 10 to 17 2534.20 .484 .685664 bits 11 to 18 2511.93 .169 .567000 bits 12 to 19 2528.13 .398 .654623 bits 13 to 20 2523.60 .334 .630728 bits 14 to 21 2480.56 -.275 .391704 bits 15 to 22 2620.54 1.705 .955874 bits 16 to 23 5467.24 41.963 1.000000 bits 17 to 24 10323.62 110.643 1.000000 bits 18 to 25 20890.35 260.079 1.000000 bits 19 to 26 43073.07 573.790 1.000000 bits 20 to 27 89364.03 1228.443 1.000000 bits 21 to 28170857.30 2380.931 1.000000 bits 22 to 29343336.60 4820.158 1.000000 bits 23 to 30672021.30 9468.461 1.000000 bits 24 to 31********* 18651.700 1.000000 bits 25 to 32********* 36938.130 1.000000 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 invcong.32 Of 12,000 tries, the average no. of successes should be 3523 with sigma=21.9 Successes: 3519 z-score: -.183 p-value: .427537 Successes: 3489 z-score: -1.553 p-value: .060270 Successes: 3506 z-score: -.776 p-value: .218799 Successes: 3533 z-score: .457 p-value: .676028 Successes: 3546 z-score: 1.050 p-value: .853193 Successes: 3520 z-score: -.137 p-value: .445521 Successes: 3499 z-score: -1.096 p-value: .136563 Successes: 3516 z-score: -.320 p-value: .374623 Successes: 3494 z-score: -1.324 p-value: .092718 Successes: 3463 z-score: -2.740 p-value: .003075 square size avg. no. parked sample sigma 100. 3508.500 22.498 KSTEST for the above 10: p= .918397 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 invcong.32 Sample no. d^2 avg equiv uni 5 .9566 1.1431 .617654 10 .2656 .9261 .234282 15 .8449 1.0238 .572204 20 1.6756 1.0399 .814370 25 3.5947 1.0597 .973024 30 .0450 1.0095 .044265 35 1.0649 .9444 .657080 40 1.5666 .9501 .792877 45 1.4512 1.0004 .767413 50 .7787 1.0120 .542785 55 .2943 .9593 .256032 60 .6946 .9490 .502479 65 .1950 .9618 .177993 70 1.0153 .9167 .639546 75 3.4914 .9391 .970071 80 .7300 .9136 .519851 85 .0550 .8892 .053734 90 .7564 .8926 .532432 95 .8488 .8837 .573879 100 1.1046 .8720 .670488 MINIMUM DISTANCE TEST for invcong.32 Result of KS test on 20 transformed mindist^2's: p-value= .597484 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 invcong.32 sample no: 1 r^3= 18.256 p-value= .45586 sample no: 2 r^3= 11.939 p-value= .32831 sample no: 3 r^3= 8.214 p-value= .23952 sample no: 4 r^3= 46.368 p-value= .78681 sample no: 5 r^3= 1.706 p-value= .05528 sample no: 6 r^3= 1.336 p-value= .04357 sample no: 7 r^3= 23.648 p-value= .54537 sample no: 8 r^3= 56.794 p-value= .84940 sample no: 9 r^3= .711 p-value= .02343 sample no: 10 r^3= 39.927 p-value= .73576 sample no: 11 r^3= 5.014 p-value= .15391 sample no: 12 r^3= 21.987 p-value= .51949 sample no: 13 r^3= 15.700 p-value= .40746 sample no: 14 r^3= 1.489 p-value= .04842 sample no: 15 r^3= 163.385 p-value= .99569 sample no: 16 r^3= 27.818 p-value= .60437 sample no: 17 r^3= 30.444 p-value= .63753 sample no: 18 r^3= 21.069 p-value= .50455 sample no: 19 r^3= 41.506 p-value= .74931 sample no: 20 r^3= 60.123 p-value= .86522 A KS test is applied to those 20 p-values. --------------------------------------------------------- 3DSPHERES test for file invcong.32 p-value= .253377 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 invcong.32 Table of standardized frequency counts ( (obs-exp)/sqrt(exp) )^2 for j taking values <=6,7,8,...,47,>=48: -.8 1.3 -.1 -1.4 1.5 -.8 .6 1.6 -.5 2.1 -.4 -.8 -1.6 .8 -.8 -.2 1.6 -.5 .7 .3 -1.1 -.2 .3 -.3 -.2 .8 -1.4 .1 .4 -1.6 .3 1.6 .5 .5 .3 1.3 .0 -.7 .1 1.0 .9 -1.0 -.1 Chi-square with 42 degrees of freedom: 38.283 z-score= -.406 p-value= .364897 ______________________________________________________________ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 .542715 Test no. 2 p-value .785393 Test no. 3 p-value .927415 Test no. 4 p-value .116333 Test no. 5 p-value .209055 Test no. 6 p-value .966893 Test no. 7 p-value .560780 Test no. 8 p-value .706630 Test no. 9 p-value .326584 Test no. 10 p-value .536987 Results of the OSUM test for invcong.32 KSTEST on the above 10 p-values: .208267 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 invcong.32 Up and down runs in a sample of 10000 _________________________________________________ Run test for invcong.32 : runs up; ks test for 10 p's: .781782 runs down; ks test for 10 p's: .295475 Run test for invcong.32 : runs up; ks test for 10 p's: .187777 runs down; ks test for 10 p's: .672562 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 invcong.32 No. of wins: Observed Expected 98556 98585.86 98556= No. of wins, z-score= -.134 pvalue= .44688 Analysis of Throws-per-Game: Chisq= 17.87 for 20 degrees of freedom, p= .40394 Throws Observed Expected Chisq Sum 1 66919 66666.7 .955 .955 2 37358 37654.3 2.332 3.287 3 27000 26954.7 .076 3.363 4 19383 19313.5 .250 3.613 5 13932 13851.4 .469 4.082 6 9985 9943.5 .173 4.255 7 7154 7145.0 .011 4.266 8 5058 5139.1 1.279 5.545 9 3749 3699.9 .653 6.198 10 2634 2666.3 .391 6.589 11 1928 1923.3 .011 6.600 12 1383 1388.7 .024 6.624 13 953 1003.7 2.562 9.187 14 698 726.1 1.091 10.277 15 509 525.8 .539 10.816 16 355 381.2 1.794 12.610 17 292 276.5 .864 13.475 18 186 200.8 1.095 14.570 19 134 146.0 .984 15.554 20 92 106.2 1.902 17.456 21 298 287.1 .413 17.869 SUMMARY FOR invcong.32 p-value for no. of wins: .446880 p-value for throws/game: .403940 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Results of DIEHARD battery of tests sent to file xxx