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 r400k.32 For a sample of size 500: mean r400k.32 using bits 1 to 24 1.938 duplicate number number spacings observed expected 0 78. 67.668 1 137. 135.335 2 122. 135.335 3 94. 90.224 4 45. 45.112 5 18. 18.045 6 to INF 6. 8.282 Chisquare with 6 d.o.f. = 3.70 p-value= .282707 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean r400k.32 using bits 2 to 25 1.952 duplicate number number spacings observed expected 0 73. 67.668 1 128. 135.335 2 143. 135.335 3 92. 90.224 4 41. 45.112 5 18. 18.045 6 to INF 5. 8.282 Chisquare with 6 d.o.f. = 2.96 p-value= .186425 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean r400k.32 using bits 3 to 26 1.940 duplicate number number spacings observed expected 0 69. 67.668 1 134. 135.335 2 144. 135.335 3 99. 90.224 4 32. 45.112 5 14. 18.045 6 to INF 8. 8.282 Chisquare with 6 d.o.f. = 6.18 p-value= .596129 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean r400k.32 using bits 4 to 27 1.976 duplicate number number spacings observed expected 0 67. 67.668 1 133. 135.335 2 144. 135.335 3 88. 90.224 4 42. 45.112 5 22. 18.045 6 to INF 4. 8.282 Chisquare with 6 d.o.f. = 3.95 p-value= .316802 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean r400k.32 using bits 5 to 28 2.044 duplicate number number spacings observed expected 0 61. 67.668 1 153. 135.335 2 125. 135.335 3 81. 90.224 4 46. 45.112 5 21. 18.045 6 to INF 13. 8.282 Chisquare with 6 d.o.f. = 7.88 p-value= .753302 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean r400k.32 using bits 6 to 29 2.004 duplicate number number spacings observed expected 0 71. 67.668 1 122. 135.335 2 147. 135.335 3 93. 90.224 4 40. 45.112 5 18. 18.045 6 to INF 9. 8.282 Chisquare with 6 d.o.f. = 3.21 p-value= .218007 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean r400k.32 using bits 7 to 30 1.968 duplicate number number spacings observed expected 0 70. 67.668 1 147. 135.335 2 117. 135.335 3 101. 90.224 4 40. 45.112 5 13. 18.045 6 to INF 12. 8.282 Chisquare with 6 d.o.f. = 8.52 p-value= .797311 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean r400k.32 using bits 8 to 31 1.964 duplicate number number spacings observed expected 0 73. 67.668 1 120. 135.335 2 140. 135.335 3 104. 90.224 4 48. 45.112 5 12. 18.045 6 to INF 3. 8.282 Chisquare with 6 d.o.f. = 10.00 p-value= .875372 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean r400k.32 using bits 9 to 32 2.006 duplicate number number spacings observed expected 0 65. 67.668 1 130. 135.335 2 145. 135.335 3 89. 90.224 4 48. 45.112 5 15. 18.045 6 to INF 8. 8.282 Chisquare with 6 d.o.f. = 1.73 p-value= .057259 ::::::::::::::::::::::::::::::::::::::::: The 9 p-values were .282707 .186425 .596129 .316802 .753302 .218007 .797311 .875372 .057259 A KSTEST for the 9 p-values yields .122195 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 r400k.32 For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=106.141; p-value= .706472 OPERM5 test for file r400k.32 For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=105.175; p-value= .683452 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 r400k.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 219 211.4 .271909 .272 29 5051 5134.0 1.342168 1.614 30 23226 23103.0 .654350 2.268 31 11504 11551.5 .195521 2.464 chisquare= 2.464 for 3 d. of f.; p-value= .576401 -------------------------------------------------------------- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 r400k.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 225 211.4 .872538 .873 30 5109 5134.0 .121837 .994 31 23171 23103.0 .199871 1.194 32 11495 11551.5 .276588 1.471 chisquare= 1.471 for 3 d. of f.; p-value= .423590 -------------------------------------------------------------- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 r400k.32 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 1 to 8 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 919 944.3 .678 .678 r =5 21580 21743.9 1.235 1.913 r =6 77501 77311.8 .463 2.376 p=1-exp(-SUM/2)= .69522 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 2 to 9 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 967 944.3 .546 .546 r =5 21432 21743.9 4.474 5.020 r =6 77601 77311.8 1.082 6.101 p=1-exp(-SUM/2)= .95267 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 3 to 10 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 947 944.3 .008 .008 r =5 21458 21743.9 3.759 3.767 r =6 77595 77311.8 1.037 4.804 p=1-exp(-SUM/2)= .90947 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 4 to 11 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 931 944.3 .187 .187 r =5 21649 21743.9 .414 .602 r =6 77420 77311.8 .151 .753 p=1-exp(-SUM/2)= .31373 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 5 to 12 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 950 944.3 .034 .034 r =5 21783 21743.9 .070 .105 r =6 77267 77311.8 .026 .131 p=1-exp(-SUM/2)= .06324 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 6 to 13 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 969 944.3 .646 .646 r =5 21705 21743.9 .070 .716 r =6 77326 77311.8 .003 .718 p=1-exp(-SUM/2)= .30170 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 7 to 14 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1007 944.3 4.163 4.163 r =5 21680 21743.9 .188 4.351 r =6 77313 77311.8 .000 4.351 p=1-exp(-SUM/2)= .88644 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 8 to 15 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 962 944.3 .332 .332 r =5 21919 21743.9 1.410 1.742 r =6 77119 77311.8 .481 2.223 p=1-exp(-SUM/2)= .67087 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 9 to 16 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 993 944.3 2.511 2.511 r =5 21812 21743.9 .213 2.725 r =6 77195 77311.8 .176 2.901 p=1-exp(-SUM/2)= .76557 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 10 to 17 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 966 944.3 .499 .499 r =5 21649 21743.9 .414 .913 r =6 77385 77311.8 .069 .982 p=1-exp(-SUM/2)= .38801 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 11 to 18 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 974 944.3 .934 .934 r =5 21765 21743.9 .020 .955 r =6 77261 77311.8 .033 .988 p=1-exp(-SUM/2)= .38979 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 12 to 19 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 947 944.3 .008 .008 r =5 21947 21743.9 1.897 1.905 r =6 77106 77311.8 .548 2.453 p=1-exp(-SUM/2)= .70663 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 13 to 20 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 933 944.3 .135 .135 r =5 21791 21743.9 .102 .237 r =6 77276 77311.8 .017 .254 p=1-exp(-SUM/2)= .11920 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 14 to 21 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 926 944.3 .355 .355 r =5 21791 21743.9 .102 .457 r =6 77283 77311.8 .011 .467 p=1-exp(-SUM/2)= .20842 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 15 to 22 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 978 944.3 1.203 1.203 r =5 21865 21743.9 .674 1.877 r =6 77157 77311.8 .310 2.187 p=1-exp(-SUM/2)= .66496 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 16 to 23 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 991 944.3 2.309 2.309 r =5 21887 21743.9 .942 3.251 r =6 77122 77311.8 .466 3.717 p=1-exp(-SUM/2)= .84410 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 17 to 24 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1026 944.3 7.068 7.068 r =5 21672 21743.9 .238 7.306 r =6 77302 77311.8 .001 7.307 p=1-exp(-SUM/2)= .97410 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 18 to 25 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 966 944.3 .499 .499 r =5 22088 21743.9 5.445 5.944 r =6 76946 77311.8 1.731 7.675 p=1-exp(-SUM/2)= .97845 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 19 to 26 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 987 944.3 1.931 1.931 r =5 21937 21743.9 1.715 3.646 r =6 77076 77311.8 .719 4.365 p=1-exp(-SUM/2)= .88723 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 20 to 27 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 981 944.3 1.426 1.426 r =5 21802 21743.9 .155 1.581 r =6 77217 77311.8 .116 1.698 p=1-exp(-SUM/2)= .57210 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 21 to 28 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 960 944.3 .261 .261 r =5 21715 21743.9 .038 .299 r =6 77325 77311.8 .002 .302 p=1-exp(-SUM/2)= .14000 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 22 to 29 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 914 944.3 .972 .972 r =5 21639 21743.9 .506 1.478 r =6 77447 77311.8 .236 1.715 p=1-exp(-SUM/2)= .57574 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 23 to 30 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 912 944.3 1.105 1.105 r =5 21500 21743.9 2.736 3.841 r =6 77588 77311.8 .987 4.827 p=1-exp(-SUM/2)= .91052 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 24 to 31 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 954 944.3 .100 .100 r =5 21814 21743.9 .226 .326 r =6 77232 77311.8 .082 .408 p=1-exp(-SUM/2)= .18453 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG r400k.32 b-rank test for bits 25 to 32 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 922 944.3 .527 .527 r =5 21720 21743.9 .026 .553 r =6 77358 77311.8 .028 .581 p=1-exp(-SUM/2)= .25194 TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices These should be 25 uniform [0,1] random variables: .695223 .952674 .909474 .313729 .063244 .301699 .886438 .670868 .765571 .388015 .389789 .706628 .119203 .208419 .664959 .844105 .974105 .978451 .887228 .572101 .140002 .575740 .910518 .184531 .251944 brank test summary for r400k.32 The KS test for those 25 supposed UNI's yields KS p-value= .746551 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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: 142156 missing words, .58 sigmas from mean, p-value= .71781 tst no 2: 142051 missing words, .33 sigmas from mean, p-value= .62968 tst no 3: 142231 missing words, .75 sigmas from mean, p-value= .77385 tst no 4: 141336 missing words, -1.34 sigmas from mean, p-value= .09020 tst no 5: 141794 missing words, -.27 sigmas from mean, p-value= .39379 tst no 6: 142618 missing words, 1.66 sigmas from mean, p-value= .95112 tst no 7: 141873 missing words, -.08 sigmas from mean, p-value= .46618 tst no 8: 141306 missing words, -1.41 sigmas from mean, p-value= .07932 tst no 9: 141844 missing words, -.15 sigmas from mean, p-value= .43934 tst no 10: 142124 missing words, .50 sigmas from mean, p-value= .69201 tst no 11: 141530 missing words, -.89 sigmas from mean, p-value= .18773 tst no 12: 142112 missing words, .47 sigmas from mean, p-value= .68208 tst no 13: 141296 missing words, -1.43 sigmas from mean, p-value= .07593 tst no 14: 141413 missing words, -1.16 sigmas from mean, p-value= .12310 tst no 15: 141320 missing words, -1.38 sigmas from mean, p-value= .08427 tst no 16: 142337 missing words, 1.00 sigmas from mean, p-value= .84116 tst no 17: 142646 missing words, 1.72 sigmas from mean, p-value= .95739 tst no 18: 142428 missing words, 1.21 sigmas from mean, p-value= .88722 tst no 19: 142437 missing words, 1.23 sigmas from mean, p-value= .89119 tst no 20: 142128 missing words, .51 sigmas from mean, p-value= .69529 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 r400k.32 Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OPSO for r400k.32 using bits 23 to 32 148826 23.851 1.0000 OPSO for r400k.32 using bits 22 to 31 141706 -.701 .2416 OPSO for r400k.32 using bits 21 to 30 142096 .644 .7401 OPSO for r400k.32 using bits 20 to 29 142240 1.140 .8729 OPSO for r400k.32 using bits 19 to 28 142138 .789 .7848 OPSO for r400k.32 using bits 18 to 27 142352 1.526 .9366 OPSO for r400k.32 using bits 17 to 26 142104 .671 .7490 OPSO for r400k.32 using bits 16 to 25 142192 .975 .8352 OPSO for r400k.32 using bits 15 to 24 141858 -.177 .4298 OPSO for r400k.32 using bits 14 to 23 142252 1.182 .8813 OPSO for r400k.32 using bits 13 to 22 141776 -.460 .3228 OPSO for r400k.32 using bits 12 to 21 142148 .823 .7947 OPSO for r400k.32 using bits 11 to 20 142290 1.313 .9054 OPSO for r400k.32 using bits 10 to 19 141911 .006 .5023 OPSO for r400k.32 using bits 9 to 18 142186 .954 .8300 OPSO for r400k.32 using bits 8 to 17 141522 -1.336 .0908 OPSO for r400k.32 using bits 7 to 16 141385 -1.808 .0353 OPSO for r400k.32 using bits 6 to 15 141439 -1.622 .0524 OPSO for r400k.32 using bits 5 to 14 141971 .213 .5842 OPSO for r400k.32 using bits 4 to 13 142195 .985 .8377 OPSO for r400k.32 using bits 3 to 12 141937 .095 .5380 OPSO for r400k.32 using bits 2 to 11 141695 -.739 .2299 OPSO for r400k.32 using bits 1 to 10 141851 -.201 .4203 OQSO test for generator r400k.32 Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OQSO for r400k.32 using bits 28 to 32 156070 48.002 1.0000 OQSO for r400k.32 using bits 27 to 31 142002 .314 .6233 OQSO for r400k.32 using bits 26 to 30 141861 -.164 .4349 OQSO for r400k.32 using bits 25 to 29 141859 -.171 .4323 OQSO for r400k.32 using bits 24 to 28 141644 -.899 .1842 OQSO for r400k.32 using bits 23 to 27 142184 .931 .8241 OQSO for r400k.32 using bits 22 to 26 141929 .067 .5266 OQSO for r400k.32 using bits 21 to 25 141459 -1.527 .0634 OQSO for r400k.32 using bits 20 to 24 141810 -.337 .3682 OQSO for r400k.32 using bits 19 to 23 142289 1.287 .9010 OQSO for r400k.32 using bits 18 to 22 141534 -1.272 .1016 OQSO for r400k.32 using bits 17 to 21 142288 1.284 .9004 OQSO for r400k.32 using bits 16 to 20 142026 .395 .6538 OQSO for r400k.32 using bits 15 to 19 141595 -1.066 .1433 OQSO for r400k.32 using bits 14 to 18 141856 -.181 .4283 OQSO for r400k.32 using bits 13 to 17 141817 -.313 .3771 OQSO for r400k.32 using bits 12 to 16 142042 .450 .6735 OQSO for r400k.32 using bits 11 to 15 142236 1.107 .8659 OQSO for r400k.32 using bits 10 to 14 141512 -1.347 .0890 OQSO for r400k.32 using bits 9 to 13 142158 .843 .8004 OQSO for r400k.32 using bits 8 to 12 141639 -.916 .1797 OQSO for r400k.32 using bits 7 to 11 141752 -.533 .2969 OQSO for r400k.32 using bits 6 to 10 141524 -1.306 .0957 OQSO for r400k.32 using bits 5 to 9 141888 -.072 .4712 OQSO for r400k.32 using bits 4 to 8 142371 1.565 .9412 OQSO for r400k.32 using bits 3 to 7 141920 .036 .5144 OQSO for r400k.32 using bits 2 to 6 141967 .195 .5775 OQSO for r400k.32 using bits 1 to 5 142128 .741 .7707 DNA test for generator r400k.32 Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p DNA for r400k.32 using bits 31 to 32 175736 99.784 1.0000 DNA for r400k.32 using bits 30 to 31 141793 -.343 .3657 DNA for r400k.32 using bits 29 to 30 141955 .135 .5536 DNA for r400k.32 using bits 28 to 29 141775 -.396 .3460 DNA for r400k.32 using bits 27 to 28 142903 2.931 .9983 DNA for r400k.32 using bits 26 to 27 141926 .049 .5196 DNA for r400k.32 using bits 25 to 26 141772 -.405 .3427 DNA for r400k.32 using bits 24 to 25 141774 -.399 .3449 DNA for r400k.32 using bits 23 to 24 142395 1.433 .9240 DNA for r400k.32 using bits 22 to 23 142319 1.208 .8866 DNA for r400k.32 using bits 21 to 22 142274 1.076 .8590 DNA for r400k.32 using bits 20 to 21 141852 -.169 .4329 DNA for r400k.32 using bits 19 to 20 141631 -.821 .2058 DNA for r400k.32 using bits 18 to 19 142048 .409 .6588 DNA for r400k.32 using bits 17 to 18 141856 -.157 .4375 DNA for r400k.32 using bits 16 to 17 142159 .736 .7693 DNA for r400k.32 using bits 15 to 16 141766 -.423 .3362 DNA for r400k.32 using bits 14 to 15 141708 -.594 .2763 DNA for r400k.32 using bits 13 to 14 141583 -.963 .1679 DNA for r400k.32 using bits 12 to 13 141900 -.028 .4890 DNA for r400k.32 using bits 11 to 12 141265 -1.901 .0287 DNA for r400k.32 using bits 10 to 11 141674 -.694 .2438 DNA for r400k.32 using bits 9 to 10 142511 1.775 .9620 DNA for r400k.32 using bits 8 to 9 141215 -2.048 .0203 DNA for r400k.32 using bits 7 to 8 142054 .427 .6652 DNA for r400k.32 using bits 6 to 7 142411 1.480 .9305 DNA for r400k.32 using bits 5 to 6 142173 .778 .7817 DNA for r400k.32 using bits 4 to 5 142189 .825 .7953 DNA for r400k.32 using bits 3 to 4 142037 .377 .6468 DNA for r400k.32 using bits 2 to 3 142093 .542 .7060 DNA for r400k.32 using bits 1 to 2 142336 1.259 .8959 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 r400k.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 r400k.32 2824.04 4.583 .999998 byte stream for r400k.32 2767.51 3.783 .999923 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 2516.43 .232 .591871 bits 2 to 9 2614.99 1.626 .948042 bits 3 to 10 2513.50 .191 .575722 bits 4 to 11 2595.20 1.346 .910912 bits 5 to 12 2669.26 2.394 .991660 bits 6 to 13 2484.75 -.216 .414638 bits 7 to 14 2485.27 -.208 .417488 bits 8 to 15 2578.34 1.108 .866040 bits 9 to 16 2673.42 2.452 .992907 bits 10 to 17 2411.16 -1.256 .104496 bits 11 to 18 2483.95 -.227 .410236 bits 12 to 19 2420.72 -1.121 .131104 bits 13 to 20 2600.86 1.426 .923120 bits 14 to 21 2433.78 -.936 .174510 bits 15 to 22 2410.58 -1.265 .103002 bits 16 to 23 2467.84 -.455 .324632 bits 17 to 24 2376.27 -1.750 .040071 bits 18 to 25 2528.74 .406 .657785 bits 19 to 26 2725.16 3.184 .999274 bits 20 to 27 2510.69 .151 .560084 bits 21 to 28 2425.20 -1.058 .145052 bits 22 to 29 2578.84 1.115 .867563 bits 23 to 30 2413.60 -1.222 .110886 bits 24 to 31 2460.90 -.553 .290155 bits 25 to 32 3144.96 9.121 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 r400k.32 Of 12,000 tries, the average no. of successes should be 3523 with sigma=21.9 Successes: 3489 z-score: -1.553 p-value: .060270 Successes: 3531 z-score: .365 p-value: .642555 Successes: 3483 z-score: -1.826 p-value: .033889 Successes: 3532 z-score: .411 p-value: .659449 Successes: 3529 z-score: .274 p-value: .607947 Successes: 3544 z-score: .959 p-value: .831196 Successes: 3539 z-score: .731 p-value: .767486 Successes: 3476 z-score: -2.146 p-value: .015932 Successes: 3498 z-score: -1.142 p-value: .126820 Successes: 3535 z-score: .548 p-value: .708135 square size avg. no. parked sample sigma 100. 3515.600 24.622 KSTEST for the above 10: p= .790365 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 r400k.32 Sample no. d^2 avg equiv uni 5 .6336 .6845 .470995 10 .5776 .8206 .440364 15 3.6786 1.0901 .975205 20 .6849 1.2274 .497583 25 .9631 1.1257 .620124 30 .7478 1.0848 .528353 35 .0796 .9986 .076869 40 .2937 1.0259 .255610 45 .3795 1.0033 .317072 50 .2117 .9793 .191652 55 .6009 1.0009 .453331 60 .1462 .9953 .136635 65 1.6996 .9578 .818803 70 .6716 .9353 .490844 75 2.9264 .9375 .947191 80 .3434 .9371 .291891 85 .0287 .9162 .028418 90 1.7936 .9109 .835135 95 .2720 .9099 .239180 100 3.0394 .9428 .952864 MINIMUM DISTANCE TEST for r400k.32 Result of KS test on 20 transformed mindist^2's: p-value= .145376 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 r400k.32 sample no: 1 r^3= 137.861 p-value= .98990 sample no: 2 r^3= 56.525 p-value= .84804 sample no: 3 r^3= 33.547 p-value= .67314 sample no: 4 r^3= 19.016 p-value= .46946 sample no: 5 r^3= .824 p-value= .02709 sample no: 6 r^3= 5.182 p-value= .15863 sample no: 7 r^3= 8.914 p-value= .25705 sample no: 8 r^3= 34.293 p-value= .68117 sample no: 9 r^3= 61.066 p-value= .86939 sample no: 10 r^3= 23.566 p-value= .54412 sample no: 11 r^3= 18.773 p-value= .46515 sample no: 12 r^3= 16.898 p-value= .43066 sample no: 13 r^3= 44.749 p-value= .77500 sample no: 14 r^3= 23.226 p-value= .53892 sample no: 15 r^3= 6.996 p-value= .20800 sample no: 16 r^3= 17.259 p-value= .43747 sample no: 17 r^3= 9.000 p-value= .25919 sample no: 18 r^3= 7.610 p-value= .22404 sample no: 19 r^3= 5.140 p-value= .15745 sample no: 20 r^3= 15.622 p-value= .40591 A KS test is applied to those 20 p-values. --------------------------------------------------------- 3DSPHERES test for file r400k.32 p-value= .190716 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 r400k.32 Table of standardized frequency counts ( (obs-exp)/sqrt(exp) )^2 for j taking values <=6,7,8,...,47,>=48: -.1 .5 -.6 -.3 -.9 .3 -.8 -1.4 .1 -.5 -1.2 -2.4 1.6 -.4 .5 .1 .6 .4 .4 .0 .5 -.1 -.1 .4 1.6 -1.8 -.8 .5 -.3 1.2 .3 .3 -1.0 -.6 .1 .4 .0 .2 .5 -.1 .9 2.0 -1.1 Chi-square with 42 degrees of freedom: 32.128 z-score= -1.077 p-value= .135267 ______________________________________________________________ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 .524320 Test no. 2 p-value .906112 Test no. 3 p-value .180505 Test no. 4 p-value .618912 Test no. 5 p-value .519336 Test no. 6 p-value .963285 Test no. 7 p-value .050353 Test no. 8 p-value .319966 Test no. 9 p-value .333626 Test no. 10 p-value .951464 Results of the OSUM test for r400k.32 KSTEST on the above 10 p-values: .244311 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 r400k.32 Up and down runs in a sample of 10000 _________________________________________________ Run test for r400k.32 : runs up; ks test for 10 p's: .314320 runs down; ks test for 10 p's: .972264 Run test for r400k.32 : runs up; ks test for 10 p's: .361468 runs down; ks test for 10 p's: .823850 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 r400k.32 No. of wins: Observed Expected 98334 98585.86 98334= No. of wins, z-score=-1.126 pvalue= .12999 Analysis of Throws-per-Game: Chisq= 22.19 for 20 degrees of freedom, p= .66978 Throws Observed Expected Chisq Sum 1 66353 66666.7 1.476 1.476 2 37861 37654.3 1.134 2.610 3 26891 26954.7 .151 2.761 4 19339 19313.5 .034 2.795 5 13779 13851.4 .379 3.173 6 9930 9943.5 .018 3.192 7 7325 7145.0 4.533 7.725 8 5305 5139.1 5.357 13.083 9 3627 3699.9 1.435 14.518 10 2634 2666.3 .391 14.909 11 1831 1923.3 4.432 19.341 12 1405 1388.7 .190 19.531 13 1009 1003.7 .028 19.559 14 747 726.1 .599 20.158 15 552 525.8 1.302 21.460 16 382 381.2 .002 21.462 17 280 276.5 .043 21.505 18 208 200.8 .256 21.761 19 142 146.0 .109 21.870 20 104 106.2 .046 21.916 21 296 287.1 .275 22.191 SUMMARY FOR r400k.32 p-value for no. of wins: .129985 p-value for throws/game: .669782 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Results of DIEHARD battery of tests sent to file result400k.txt