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 outdiv.bin For a sample of size 500: mean outdiv.bin using bits 1 to 24 1.982 duplicate number number spacings observed expected 0 73. 67.668 1 135. 135.335 2 138. 135.335 3 81. 90.224 4 41. 45.112 5 22. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = 3.01 p-value= .192992 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean outdiv.bin using bits 2 to 25 1.880 duplicate number number spacings observed expected 0 68. 67.668 1 156. 135.335 2 127. 135.335 3 87. 90.224 4 43. 45.112 5 18. 18.045 6 to INF 1. 8.282 Chisquare with 6 d.o.f. = 10.29 p-value= .886927 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean outdiv.bin using bits 3 to 26 1.946 duplicate number number spacings observed expected 0 64. 67.668 1 136. 135.335 2 149. 135.335 3 90. 90.224 4 42. 45.112 5 15. 18.045 6 to INF 4. 8.282 Chisquare with 6 d.o.f. = 4.52 p-value= .393922 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean outdiv.bin using bits 4 to 27 2.084 duplicate number number spacings observed expected 0 56. 67.668 1 128. 135.335 2 150. 135.335 3 90. 90.224 4 48. 45.112 5 18. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = 4.54 p-value= .396053 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean outdiv.bin using bits 5 to 28 1.972 duplicate number number spacings observed expected 0 69. 67.668 1 133. 135.335 2 142. 135.335 3 88. 90.224 4 43. 45.112 5 20. 18.045 6 to INF 5. 8.282 Chisquare with 6 d.o.f. = 2.06 p-value= .085972 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean outdiv.bin using bits 6 to 29 1.918 duplicate number number spacings observed expected 0 81. 67.668 1 131. 135.335 2 141. 135.335 3 80. 90.224 4 42. 45.112 5 16. 18.045 6 to INF 9. 8.282 Chisquare with 6 d.o.f. = 4.67 p-value= .413207 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean outdiv.bin using bits 7 to 30 1.958 duplicate number number spacings observed expected 0 68. 67.668 1 134. 135.335 2 132. 135.335 3 105. 90.224 4 43. 45.112 5 15. 18.045 6 to INF 3. 8.282 Chisquare with 6 d.o.f. = 6.50 p-value= .630245 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean outdiv.bin using bits 8 to 31 2.028 duplicate number number spacings observed expected 0 64. 67.668 1 135. 135.335 2 132. 135.335 3 93. 90.224 4 51. 45.112 5 18. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 1.33 p-value= .030269 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean outdiv.bin using bits 9 to 32 2.100 duplicate number number spacings observed expected 0 52. 67.668 1 142. 135.335 2 135. 135.335 3 86. 90.224 4 57. 45.112 5 18. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = 7.64 p-value= .734628 ::::::::::::::::::::::::::::::::::::::::: The 9 p-values were .192992 .886927 .393922 .396053 .085972 .413207 .630245 .030269 .734628 A KSTEST for the 9 p-values yields .298221 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 outdiv.bin For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom= 97.813; p-value= .485120 OPERM5 test for file outdiv.bin For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=103.107; p-value= .631297 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 outdiv.bin 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 226 211.4 1.005753 1.006 29 5217 5134.0 1.341505 2.347 30 23106 23103.0 .000377 2.348 31 11451 11551.5 .874790 3.222 chisquare= 3.222 for 3 d. of f.; p-value= .677732 -------------------------------------------------------------- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 outdiv.bin 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 242 211.4 4.423738 4.424 30 5057 5134.0 1.155155 5.579 31 23146 23103.0 .079858 5.659 32 11555 11551.5 .001046 5.660 chisquare= 5.660 for 3 d. of f.; p-value= .879292 -------------------------------------------------------------- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 outdiv.bin Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 1 to 8 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 926 944.3 .355 .355 r =5 21976 21743.9 2.477 2.832 r =6 77098 77311.8 .591 3.423 p=1-exp(-SUM/2)= .81945 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 2 to 9 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 920 944.3 .625 .625 r =5 21862 21743.9 .641 1.267 r =6 77218 77311.8 .114 1.381 p=1-exp(-SUM/2)= .49859 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 3 to 10 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 933 944.3 .135 .135 r =5 21741 21743.9 .000 .136 r =6 77326 77311.8 .003 .138 p=1-exp(-SUM/2)= .06679 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 4 to 11 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 873 944.3 5.384 5.384 r =5 21686 21743.9 .154 5.538 r =6 77441 77311.8 .216 5.754 p=1-exp(-SUM/2)= .94369 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 5 to 12 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 886 944.3 3.600 3.600 r =5 21750 21743.9 .002 3.601 r =6 77364 77311.8 .035 3.636 p=1-exp(-SUM/2)= .83769 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 6 to 13 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 942 944.3 .006 .006 r =5 21882 21743.9 .877 .883 r =6 77176 77311.8 .239 1.121 p=1-exp(-SUM/2)= .42915 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 7 to 14 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 953 944.3 .080 .080 r =5 21885 21743.9 .916 .996 r =6 77162 77311.8 .290 1.286 p=1-exp(-SUM/2)= .47429 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 8 to 15 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 907 944.3 1.473 1.473 r =5 21819 21743.9 .259 1.733 r =6 77274 77311.8 .018 1.751 p=1-exp(-SUM/2)= .58341 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 9 to 16 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 951 944.3 .048 .048 r =5 21761 21743.9 .013 .061 r =6 77288 77311.8 .007 .068 p=1-exp(-SUM/2)= .03357 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 10 to 17 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 940 944.3 .020 .020 r =5 21819 21743.9 .259 .279 r =6 77241 77311.8 .065 .344 p=1-exp(-SUM/2)= .15794 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 11 to 18 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 935 944.3 .092 .092 r =5 21911 21743.9 1.284 1.376 r =6 77154 77311.8 .322 1.698 p=1-exp(-SUM/2)= .57213 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 12 to 19 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1012 944.3 4.853 4.853 r =5 21774 21743.9 .042 4.895 r =6 77214 77311.8 .124 5.019 p=1-exp(-SUM/2)= .91868 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 13 to 20 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 910 944.3 1.246 1.246 r =5 21823 21743.9 .288 1.534 r =6 77267 77311.8 .026 1.560 p=1-exp(-SUM/2)= .54152 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 14 to 21 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 960 944.3 .261 .261 r =5 21799 21743.9 .140 .401 r =6 77241 77311.8 .065 .465 p=1-exp(-SUM/2)= .20763 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 15 to 22 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 934 944.3 .112 .112 r =5 21943 21743.9 1.823 1.935 r =6 77123 77311.8 .461 2.397 p=1-exp(-SUM/2)= .69828 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 16 to 23 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 926 944.3 .355 .355 r =5 21976 21743.9 2.477 2.832 r =6 77098 77311.8 .591 3.423 p=1-exp(-SUM/2)= .81945 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 17 to 24 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 910 944.3 1.246 1.246 r =5 21704 21743.9 .073 1.319 r =6 77386 77311.8 .071 1.390 p=1-exp(-SUM/2)= .50103 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 18 to 25 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 985 944.3 1.754 1.754 r =5 21456 21743.9 3.812 5.566 r =6 77559 77311.8 .790 6.356 p=1-exp(-SUM/2)= .95834 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 19 to 26 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 961 944.3 .295 .295 r =5 21772 21743.9 .036 .332 r =6 77267 77311.8 .026 .358 p=1-exp(-SUM/2)= .16372 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 20 to 27 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 960 944.3 .261 .261 r =5 21561 21743.9 1.538 1.799 r =6 77479 77311.8 .362 2.161 p=1-exp(-SUM/2)= .66058 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 21 to 28 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 903 944.3 1.806 1.806 r =5 21813 21743.9 .220 2.026 r =6 77284 77311.8 .010 2.036 p=1-exp(-SUM/2)= .63868 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 22 to 29 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 926 944.3 .355 .355 r =5 21800 21743.9 .145 .499 r =6 77274 77311.8 .018 .518 p=1-exp(-SUM/2)= .22814 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 23 to 30 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 916 944.3 .848 .848 r =5 21883 21743.9 .890 1.738 r =6 77201 77311.8 .159 1.897 p=1-exp(-SUM/2)= .61265 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 24 to 31 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 937 944.3 .056 .056 r =5 21831 21743.9 .349 .405 r =6 77232 77311.8 .082 .488 p=1-exp(-SUM/2)= .21641 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG outdiv.bin b-rank test for bits 25 to 32 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 977 944.3 1.132 1.132 r =5 21711 21743.9 .050 1.182 r =6 77312 77311.8 .000 1.182 p=1-exp(-SUM/2)= .44624 TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices These should be 25 uniform [0,1] random variables: .819446 .498586 .066788 .943691 .837689 .429150 .474293 .583413 .033572 .157944 .572128 .918685 .541523 .207631 .698283 .819446 .501025 .958340 .163716 .660582 .638683 .228145 .612651 .216405 .446242 brank test summary for outdiv.bin The KS test for those 25 supposed UNI's yields KS p-value= .089596 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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: 142924 missing words, 2.37 sigmas from mean, p-value= .99112 tst no 2: 141989 missing words, .19 sigmas from mean, p-value= .57384 tst no 3: 142731 missing words, 1.92 sigmas from mean, p-value= .97256 tst no 4: 142488 missing words, 1.35 sigmas from mean, p-value= .91182 tst no 5: 142170 missing words, .61 sigmas from mean, p-value= .72875 tst no 6: 142396 missing words, 1.14 sigmas from mean, p-value= .87225 tst no 7: 143016 missing words, 2.59 sigmas from mean, p-value= .99514 tst no 8: 142557 missing words, 1.51 sigmas from mean, p-value= .93489 tst no 9: 142727 missing words, 1.91 sigmas from mean, p-value= .97196 tst no 10: 141846 missing words, -.15 sigmas from mean, p-value= .44119 tst no 11: 141474 missing words, -1.02 sigmas from mean, p-value= .15455 tst no 12: 142135 missing words, .53 sigmas from mean, p-value= .70100 tst no 13: 142674 missing words, 1.79 sigmas from mean, p-value= .96300 tst no 14: 142430 missing words, 1.22 sigmas from mean, p-value= .88811 tst no 15: 142711 missing words, 1.87 sigmas from mean, p-value= .96947 tst no 16: 142042 missing words, .31 sigmas from mean, p-value= .62171 tst no 17: 142416 missing words, 1.18 sigmas from mean, p-value= .88176 tst no 18: 142192 missing words, .66 sigmas from mean, p-value= .74552 tst no 19: 142216 missing words, .72 sigmas from mean, p-value= .76317 tst no 20: 143005 missing words, 2.56 sigmas from mean, p-value= .99477 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 outdiv.bin Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OPSO for outdiv.bin using bits 23 to 32 142704 2.740 .9969 OPSO for outdiv.bin using bits 22 to 31 142383 1.633 .9488 OPSO for outdiv.bin using bits 21 to 30 142316 1.402 .9196 OPSO for outdiv.bin using bits 20 to 29 142815 3.123 .9991 OPSO for outdiv.bin using bits 19 to 28 143173 4.357 1.0000 OPSO for outdiv.bin using bits 18 to 27 143576 5.747 1.0000 OPSO for outdiv.bin using bits 17 to 26 143571 5.730 1.0000 OPSO for outdiv.bin using bits 16 to 25 142885 3.364 .9996 OPSO for outdiv.bin using bits 15 to 24 142460 1.899 .9712 OPSO for outdiv.bin using bits 14 to 23 142740 2.864 .9979 OPSO for outdiv.bin using bits 13 to 22 142792 3.044 .9988 OPSO for outdiv.bin using bits 12 to 21 143024 3.844 .9999 OPSO for outdiv.bin using bits 11 to 20 143122 4.182 1.0000 OPSO for outdiv.bin using bits 10 to 19 143315 4.847 1.0000 OPSO for outdiv.bin using bits 9 to 18 143682 6.113 1.0000 OPSO for outdiv.bin using bits 8 to 17 142667 2.613 .9955 OPSO for outdiv.bin using bits 7 to 16 142343 1.495 .9326 OPSO for outdiv.bin using bits 6 to 15 142429 1.792 .9634 OPSO for outdiv.bin using bits 5 to 14 142446 1.851 .9679 OPSO for outdiv.bin using bits 4 to 13 143361 5.006 1.0000 OPSO for outdiv.bin using bits 3 to 12 143010 3.795 .9999 OPSO for outdiv.bin using bits 2 to 11 143285 4.744 1.0000 OPSO for outdiv.bin using bits 1 to 10 143770 6.416 1.0000 OQSO test for generator outdiv.bin Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OQSO for outdiv.bin using bits 28 to 32 142043 .453 .6748 OQSO for outdiv.bin using bits 27 to 31 141732 -.601 .2739 OQSO for outdiv.bin using bits 26 to 30 141957 .162 .5642 OQSO for outdiv.bin using bits 25 to 29 141842 -.228 .4097 OQSO for outdiv.bin using bits 24 to 28 141246 -2.249 .0123 OQSO for outdiv.bin using bits 23 to 27 142033 .419 .6625 OQSO for outdiv.bin using bits 22 to 26 142156 .836 .7985 OQSO for outdiv.bin using bits 21 to 25 141844 -.221 .4124 OQSO for outdiv.bin using bits 20 to 24 141733 -.598 .2750 OQSO for outdiv.bin using bits 19 to 23 142105 .663 .7464 OQSO for outdiv.bin using bits 18 to 22 141837 -.245 .4032 OQSO for outdiv.bin using bits 17 to 21 142478 1.928 .9731 OQSO for outdiv.bin using bits 16 to 20 141804 -.357 .3605 OQSO for outdiv.bin using bits 15 to 19 142255 1.172 .8794 OQSO for outdiv.bin using bits 14 to 18 142183 .928 .8232 OQSO for outdiv.bin using bits 13 to 17 141923 .046 .5185 OQSO for outdiv.bin using bits 12 to 16 142131 .751 .7738 OQSO for outdiv.bin using bits 11 to 15 142149 .812 .7917 OQSO for outdiv.bin using bits 10 to 14 142397 1.653 .9508 OQSO for outdiv.bin using bits 9 to 13 143045 3.850 .9999 OQSO for outdiv.bin using bits 8 to 12 141949 .134 .5535 OQSO for outdiv.bin using bits 7 to 11 142753 2.860 .9979 OQSO for outdiv.bin using bits 6 to 10 141683 -.767 .2215 OQSO for outdiv.bin using bits 5 to 9 142283 1.267 .8974 OQSO for outdiv.bin using bits 4 to 8 142426 1.751 .9601 OQSO for outdiv.bin using bits 3 to 7 141164 -2.527 .0058 OQSO for outdiv.bin using bits 2 to 6 142406 1.684 .9539 OQSO for outdiv.bin using bits 1 to 5 141149 -2.577 .0050 DNA test for generator outdiv.bin Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p DNA for outdiv.bin using bits 31 to 32 142042 .391 .6522 DNA for outdiv.bin using bits 30 to 31 141771 -.408 .3416 DNA for outdiv.bin using bits 29 to 30 141932 .067 .5267 DNA for outdiv.bin using bits 28 to 29 142160 .739 .7702 DNA for outdiv.bin using bits 27 to 28 141623 -.845 .1992 DNA for outdiv.bin using bits 26 to 27 142383 1.397 .9188 DNA for outdiv.bin using bits 25 to 26 141899 -.030 .4878 DNA for outdiv.bin using bits 24 to 25 141514 -1.166 .1218 DNA for outdiv.bin using bits 23 to 24 141760 -.440 .3298 DNA for outdiv.bin using bits 22 to 23 142505 1.757 .9606 DNA for outdiv.bin using bits 21 to 22 141620 -.853 .1967 DNA for outdiv.bin using bits 20 to 21 141689 -.650 .2579 DNA for outdiv.bin using bits 19 to 20 142033 .365 .6424 DNA for outdiv.bin using bits 18 to 19 142209 .884 .8116 DNA for outdiv.bin using bits 17 to 18 141852 -.169 .4329 DNA for outdiv.bin using bits 16 to 17 142076 .492 .6885 DNA for outdiv.bin using bits 15 to 16 141715 -.573 .2832 DNA for outdiv.bin using bits 14 to 15 142093 .542 .7060 DNA for outdiv.bin using bits 13 to 14 141431 -1.411 .0791 DNA for outdiv.bin using bits 12 to 13 141915 .017 .5067 DNA for outdiv.bin using bits 11 to 12 141988 .232 .5918 DNA for outdiv.bin using bits 10 to 11 141988 .232 .5918 DNA for outdiv.bin using bits 9 to 10 141534 -1.107 .1341 DNA for outdiv.bin using bits 8 to 9 142158 .734 .7684 DNA for outdiv.bin using bits 7 to 8 142136 .669 .7481 DNA for outdiv.bin using bits 6 to 7 142460 1.624 .9479 DNA for outdiv.bin using bits 5 to 6 142439 1.562 .9409 DNA for outdiv.bin using bits 4 to 5 142045 .400 .6555 DNA for outdiv.bin using bits 3 to 4 142727 2.412 .9921 DNA for outdiv.bin using bits 2 to 3 141859 -.148 .4410 DNA for outdiv.bin using bits 1 to 2 141981 .211 .5837 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 outdiv.bin 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 outdiv.bin 2442.82 -.809 .209373 byte stream for outdiv.bin 2302.93 -2.787 .002660 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the COUNT-THE-1's TEST for specific bytes. :: :: Consider the file under test as a stream of 32-bit integers. :: :: From each integer, a specific byte is chosen , say the left- :: :: most:: bits 1 to 8. Each byte can contain from 0 to 8 1's, :: :: with probabilitie 1,8,28,56,70,56,28,8,1 over 256. Now let :: :: the specified bytes from successive integers provide a string :: :: of (overlapping) 5-letter words, each "letter" taking values :: :: A,B,C,D,E. The letters are determined by the number of 1's, :: :: in that byte:: 0,1,or 2 ---> A, 3 ---> B, 4 ---> C, 5 ---> D,:: :: and 6,7 or 8 ---> E. Thus we have a monkey at a typewriter :: :: hitting five keys with with various probabilities:: 37,56,70,:: :: 56,37 over 256. There are 5^5 possible 5-letter words, and :: :: from a string of 256,000 (overlapping) 5-letter words, counts :: :: are made on the frequencies for each word. The quadratic form :: :: in the weak inverse of the covariance matrix of the cell :: :: counts provides a chisquare test:: Q5-Q4, the difference of :: :: the naive Pearson sums of (OBS-EXP)^2/EXP on counts for 5- :: :: and 4-letter cell counts. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Chi-square with 5^5-5^4=2500 d.of f. for sample size: 256000 chisquare equiv normal p value Results for COUNT-THE-1's in specified bytes: bits 1 to 8 2517.01 .241 .595057 bits 2 to 9 2462.34 -.533 .297164 bits 3 to 10 2556.57 .800 .788156 bits 4 to 11 2520.45 .289 .613813 bits 5 to 12 2485.64 -.203 .419511 bits 6 to 13 2518.82 .266 .604944 bits 7 to 14 2553.19 .752 .774033 bits 8 to 15 2489.32 -.151 .439963 bits 9 to 16 2625.58 1.776 .962130 bits 10 to 17 2567.38 .953 .829667 bits 11 to 18 2538.34 .542 .706171 bits 12 to 19 2539.76 .562 .713064 bits 13 to 20 2422.39 -1.098 .136200 bits 14 to 21 2535.41 .501 .691757 bits 15 to 22 2426.46 -1.040 .149166 bits 16 to 23 2486.57 -.190 .424655 bits 17 to 24 2574.05 1.047 .852488 bits 18 to 25 2549.63 .702 .758614 bits 19 to 26 2488.81 -.158 .437119 bits 20 to 27 2519.02 .269 .606022 bits 21 to 28 2575.60 1.069 .857484 bits 22 to 29 2510.96 .155 .561566 bits 23 to 30 2643.00 2.022 .978428 bits 24 to 31 2555.32 .782 .783011 bits 25 to 32 2538.02 .538 .704608 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 outdiv.bin Of 12,000 tries, the average no. of successes should be 3523 with sigma=21.9 Successes: 3520 z-score: -.137 p-value: .445521 Successes: 3538 z-score: .685 p-value: .753306 Successes: 3468 z-score: -2.511 p-value: .006012 Successes: 3530 z-score: .320 p-value: .625377 Successes: 3515 z-score: -.365 p-value: .357445 Successes: 3551 z-score: 1.279 p-value: .899470 Successes: 3558 z-score: 1.598 p-value: .944998 Successes: 3519 z-score: -.183 p-value: .427537 Successes: 3533 z-score: .457 p-value: .676028 Successes: 3548 z-score: 1.142 p-value: .873180 square size avg. no. parked sample sigma 100. 3528.000 24.216 KSTEST for the above 10: p= .629880 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 outdiv.bin Sample no. d^2 avg equiv uni 5 .3569 .7062 .301378 10 1.3184 .5711 .734194 15 .6724 .6205 .491227 20 .0105 .7785 .010479 25 .9794 .7639 .626323 30 .7994 .7013 .552225 35 1.2185 .6763 .706145 40 2.2612 .7247 .896950 45 .7887 .8014 .547375 50 1.2189 .8426 .706261 55 1.1795 .8935 .694390 60 .1192 .8470 .112878 65 1.1714 .8521 .691883 70 .6646 .8741 .487252 75 2.0129 .8823 .867747 80 .1384 .9024 .129883 85 2.4513 .8885 .914873 90 .3418 .9185 .290759 95 .9452 .9123 .613235 100 .9808 .9112 .626818 MINIMUM DISTANCE TEST for outdiv.bin Result of KS test on 20 transformed mindist^2's: p-value= .830309 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 outdiv.bin sample no: 1 r^3= 25.128 p-value= .56725 sample no: 2 r^3= 57.412 p-value= .85247 sample no: 3 r^3= 9.269 p-value= .26580 sample no: 4 r^3= 31.345 p-value= .64824 sample no: 5 r^3= 8.695 p-value= .25161 sample no: 6 r^3= 13.252 p-value= .35707 sample no: 7 r^3= 68.874 p-value= .89932 sample no: 8 r^3= 49.897 p-value= .81047 sample no: 9 r^3= 48.028 p-value= .79829 sample no: 10 r^3= 11.551 p-value= .31957 sample no: 11 r^3= 5.379 p-value= .16414 sample no: 12 r^3= 42.369 p-value= .75642 sample no: 13 r^3= 102.956 p-value= .96767 sample no: 14 r^3= 42.012 p-value= .75350 sample no: 15 r^3= 28.034 p-value= .60721 sample no: 16 r^3= 33.675 p-value= .67453 sample no: 17 r^3= 12.939 p-value= .35034 sample no: 18 r^3= 14.394 p-value= .38110 sample no: 19 r^3= 15.754 p-value= .40852 sample no: 20 r^3= 3.757 p-value= .11771 A KS test is applied to those 20 p-values. --------------------------------------------------------- 3DSPHERES test for file outdiv.bin p-value= .354591 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 outdiv.bin Table of standardized frequency counts ( (obs-exp)/sqrt(exp) )^2 for j taking values <=6,7,8,...,47,>=48: -.8 .1 -.8 .2 -2.1 -1.5 1.3 1.2 -1.8 -1.2 -1.1 -.3 .1 .7 .1 -.1 -.6 .2 .9 .3 1.0 -1.1 -.4 .9 -.8 -.4 1.4 .4 .3 -.5 1.3 -1.5 .6 -1.4 .3 .6 .7 .5 .1 1.0 1.6 .0 .8 Chi-square with 42 degrees of freedom: 37.212 z-score= -.522 p-value= .318882 ______________________________________________________________ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 .501186 Test no. 2 p-value .411127 Test no. 3 p-value .128923 Test no. 4 p-value .939062 Test no. 5 p-value .421814 Test no. 6 p-value .321254 Test no. 7 p-value .005718 Test no. 8 p-value .650870 Test no. 9 p-value .980092 Test no. 10 p-value .446905 Results of the OSUM test for outdiv.bin KSTEST on the above 10 p-values: .319289 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 outdiv.bin Up and down runs in a sample of 10000 _________________________________________________ Run test for outdiv.bin : runs up; ks test for 10 p's: .336458 runs down; ks test for 10 p's: .385198 Run test for outdiv.bin : runs up; ks test for 10 p's: .673492 runs down; ks test for 10 p's: .750297 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 outdiv.bin No. of wins: Observed Expected 98797 98585.86 98797= No. of wins, z-score= .944 pvalue= .82750 Analysis of Throws-per-Game: Chisq= 19.09 for 20 degrees of freedom, p= .48370 Throws Observed Expected Chisq Sum 1 67057 66666.7 2.285 2.285 2 37712 37654.3 .088 2.374 3 26765 26954.7 1.335 3.709 4 19305 19313.5 .004 3.713 5 13692 13851.4 1.835 5.548 6 9971 9943.5 .076 5.623 7 7194 7145.0 .336 5.959 8 5085 5139.1 .569 6.528 9 3558 3699.9 5.440 11.968 10 2658 2666.3 .026 11.993 11 1907 1923.3 .139 12.132 12 1419 1388.7 .659 12.791 13 998 1003.7 .033 12.824 14 749 726.1 .720 13.544 15 537 525.8 .237 13.781 16 398 381.2 .745 14.525 17 275 276.5 .009 14.534 18 212 200.8 .621 15.155 19 130 146.0 1.750 16.906 20 91 106.2 2.180 19.085 21 287 287.1 .000 19.085 SUMMARY FOR outdiv.bin p-value for no. of wins: .827503 p-value for throws/game: .483702 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Results of DIEHARD battery of tests sent to file outdiv.txt