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 often just an approximation, for which the fit will likely be worst in the tails. Thus you should not be surprised with occasion- al 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 RNGs. So keep in mind that "p happens" Enter the name of the file to be tested. This must be a form="unformatted",access="direct" binary file of about 10-12 million bytes. Enter file name: Which tests do you want to perform? For all tests, enter 17 1's: 11111111111111111: To choose, say, tests 1, 3, 7, 14 enter: 10100010000001000: HERE ARE YOUR CHOICES: 1 Birthday Spacings 2 GCD 3 Gorilla 4 Overlapping Permutations 5 Ranks of 31x31 and 32x32 matrices 6 Ranks of 6x8 Matrices 7 Monkey Tests on 20-bit Words 8 Monkey Tests OPSO,OQSO,DNA 9 Count the 1`s in a Stream of Bytes 10 Count the 1`s in Specific Bytes 11 Parking Lot Test 12 Minimum Distance Test 13 Random Spheres Test 14 The Sqeeze Test 15 Overlapping Sums Test 16 Runs Up and Down Test 17 The Craps Test Enter your choices, 1's yes, 0's no using 17 columns: 12345678901234567 |-------------------------------------------------------------| | This is the BIRTHDAY SPACINGS TEST | |Choose m birthdays in a "year" of n days. List the spacings | |between the birthdays. Let j be 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^10, so that the underlying distribution for j | |is taken to be Poisson with lambda=2^30/(2^26)=16. A sample | |of 200 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 32-bit integers in the specified file. | |The file is closed and reopened, then bits 2-25 of the same | |integers are used to provide birthdays, 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. | |------------------------------------------------------------ | RESULTS OF BIRTHDAY SPACINGS FOR mersenn.bin (no_bdays=1024, no_days/yr=2^24, lambda=16.00, sample size=500) Bits used mean chisqr p-value 1 to 24 15.87 12.4504 0.227867 2 to 25 16.00 19.4029 0.694098 3 to 26 15.83 24.4613 0.892566 4 to 27 16.25 14.2473 0.350475 5 to 28 15.64 20.2091 0.736328 6 to 29 15.83 22.6797 0.840028 7 to 30 15.60 13.7908 0.318146 8 to 31 15.90 19.2606 0.686218 9 to 32 15.84 24.2019 0.885948 Chisquare degrees of freedom: 17 --------------------------------------------------------------- p-value for KStest on those 9 p-values: 0.264923 |-------------------------------------------------------------| | This is the "tough" BIRTHDAY SPACINGS TEST | |Choose 4096 birthdays in a "year" of 2^32 days. Thus each | |birthday is a 32-bit integer and the test uses 2^12 of them, | |so that j, the number of duplicate spacings, is asympotically| |Poisson distributed with lambda=4 . Generators that pass the| |earlier tests for m=1024 and n=2^24 often fail this test, yet| |those that pass this test seem to pass the "weaker" test. | |Each set of 4096 birthdays provide a Poisson variate j, and | |500 such j's lead to a chisquare test to see if the result | |is consistent with the Poisson distribution with lambda=16. | |------------------------------------------------------------ | Tough bday spacings test for mersenn.bin: 4096 birthdays, year=2^32 days Table of Expected vs. Observed counts: Duplicates 0 1 2 3 4 5 6 7 8 9 >=10 Expected 9.2 36.6 73.3 97.7 97.7 78.1 52.1 29.8 14.9 6.6 4.1 Observed 7 35 81 100 89 81 43 37 17 9 1 (O-E)^2/E 0.5 0.1 0.8 0.1 0.8 0.1 1.6 1.8 0.3 0.9 2.3 Birthday Spacings: Sum(O-E)^2/E= 9.146, p= 0.482 |-----------------------------------------------------------| |This is the GCD TEST. Let the (32-bit) RNG produce two | |successive integers u,v. Use Euclids algorithm to find the| |gcd, say x, of u and v. Let k be the number of steps needed| |to get x. Then k is approximately binomial with p=.376 | |and n=50, while the distribution of x is very close to | | Pr(x=i)=c/i^2, with c=6/pi^2. The gcd test uses ten | |million such pairs u,v to see if the resulting frequencies | |of k's and x's are consistent with the above distributions.| |Congruential RNG's---even those with prime modulus---fail | |this test for the distribution of k, the number of steps, | |and often for the distribution of gcd values x as well. | |-----------------------------------------------------------| RESULTS OF GCD FOR mersenn.bin Euclid's algorithm: p-value, steps to gcd: 0.620647 p-value, dist. of gcd's: 0.520841 |-----------------------------------------------------------| |This is the GORILLA test, a strong version of the monkey | |tests that I developed in the 70's. It concerns strings | |formed from specified bits in 32-bit integers from the RNG.| |We specify the bit position to be studied, from 0 to 31, | |say bit 3. Then we generate 67,108,889 (2^26+25) numbers | |from the generator and form a string of 2^26+25 bits by | |taking bit 3 from each of those numbers. In that string of | |2^26+25 bits we count the number of 26-bit segments that | |do not appear. That count should be approximately normal | |with mean 24687971 and std. deviation 4170. This leads to | |a normal z-score and hence to a p-value. The test is | |applied for each bit position 0 (leftmost) to 31. | |(Some older tests use Fortran's 1-32 for most- to least- | |significant bits. Gorilla and newer tests use C's 0 to 31.)| |-----------------------------------------------------------| Gorilla test for 2^26 bits, positions 0 to 31 for mersenn.bin: Note: lengthy test---for example, ~20 minutes for 850MHz PC Bits 0 to 7---> 0.757 0.578 0.217 0.261 0.600 0.767 0.133 0.993 Bits 8 to 15---> 0.024 0.084 0.700 0.470 0.303 0.745 0.820 0.180 Bits 16 to 23---> 0.669 0.639 0.969 0.186 0.551 0.822 0.046 0.561 Bits 24 to 31---> 0.477 0.670 0.531 0.334 0.485 0.781 0.190 0.499 KS test for the above 32 p values: 0.148 |-------------------------------------------------------------| | THE OVERLAPPING 5-PERMUTATION TEST | |This is the OPERM5 test. It looks at a sequence of ten 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 | |that the 120 cellcounts came from the specified (asymptotic) | |distribution with the specified means and 120x120 covariance.| |-------------------------------------------------------------| The OPERM5 test for 10 million (overlapping) 5-tuples for mersenn.bin, p-values for 5 runs: 0.3333, 0.9720, 0.2842, 0.8756, 0.3837 |-------------------------------------------------------------| |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 chisqu-| |are test is performed on counts for ranks 31,30,28 and <=28. | | (The 31x31 choice is based on the unjustified popularity of | | the proposed "industry standard" generator | | x(n) = 16807*x(n-1) mod 2^31-1, not a very good one.) | |-------------------------------------------------------------| Rank test for binary matrices (31x31) for mersenn.bin RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=28 202 211.4 0.420 0.420 r= 29 5160 5134.0 0.132 0.551 r= 30 23160 23103.0 0.140 0.692 r= 31 11478 11551.5 0.468 1.159 chi-square = 1.159 with df = 3; p-value = 0.237 -------------------------------------------------------------- |-------------------------------------------------------------| |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. | |-------------------------------------------------------------| Rank test for binary matrices (32x32) for mersenn.bin RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=29 221 211.4 0.434 0.434 r= 30 5169 5134.0 0.238 0.673 r= 31 23012 23103.0 0.359 1.032 r= 32 11598 11551.5 0.187 1.219 chi-square = 1.219 with df = 3; p-value = 0.251 -------------------------------------------------------------- |-------------------------------------------------------------| |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 <=4, 5 and 6. | |-------------------------------------------------------------| Rank test for binary matrices (6x8) for mersenn.bin b-rank test for bits 1 to 8, p=0.81794 b-rank test for bits 2 to 9, p=0.45419 b-rank test for bits 3 to 10, p=0.52160 b-rank test for bits 4 to 11, p=0.80192 b-rank test for bits 5 to 12, p=0.79126 b-rank test for bits 6 to 13, p=0.46062 b-rank test for bits 7 to 14, p=0.54608 b-rank test for bits 8 to 15, p=0.56689 b-rank test for bits 9 to 16, p=0.72196 b-rank test for bits 10 to 17, p=0.38386 b-rank test for bits 11 to 18, p=0.16415 b-rank test for bits 12 to 19, p=0.66578 b-rank test for bits 13 to 20, p=0.13334 b-rank test for bits 14 to 21, p=0.93979 b-rank test for bits 15 to 22, p=0.52527 b-rank test for bits 16 to 23, p=0.54318 b-rank test for bits 17 to 24, p=0.47972 b-rank test for bits 18 to 25, p=0.28246 b-rank test for bits 19 to 26, p=0.77189 b-rank test for bits 20 to 27, p=0.59741 b-rank test for bits 21 to 28, p=0.74016 b-rank test for bits 22 to 29, p=0.21649 b-rank test for bits 23 to 30, p=0.77486 b-rank test for bits 24 to 31, p=0.18989 b-rank test for bits 25 to 32, p=0.25299 TEST SUMMARY, 25 tests, each on 100,000 random 6x8 matrices The above should be 25 uniform [0,1] random variables: The KS test for those 25 supposed UNI's yields p = 0.321131 |-------------------------------------------------------------| | 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 for mersenn.bin (20 bits/word, 2097152 words 20 bitstreams. No. missing words should average 141909.33 with sigma=428.00.) ---------------------------------------------------------------- BITSTREAM test results. Bitstream No. missing words z-score p-value 1 142013 0.24 0.595695 2 142028 0.28 0.609212 3 141242 -1.56 0.059477 4 142229 0.75 0.772436 5 142489 1.35 0.912191 6 141723 -0.44 0.331654 7 141694 -0.50 0.307444 8 141999 0.21 0.582975 9 141580 -0.77 0.220809 10 141422 -1.14 0.127431 11 141648 -0.61 0.270738 12 141487 -0.99 0.161882 13 141813 -0.23 0.410962 14 142105 0.46 0.676227 15 142080 0.40 0.654966 16 142463 1.29 0.902102 17 141682 -0.53 0.297659 18 142098 0.44 0.670328 19 142058 0.35 0.635840 20 141199 -1.66 0.048492 ---------------------------------------------------------------- |-------------------------------------------------------------| | 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. | |------------------------------------------------------------ | OPSO test for mersenn.bin Bits used No. missing words z-score p-value 23 to 32 141699 -0.7253 0.234141 22 to 31 141981 0.2471 0.597599 21 to 30 142008 0.3402 0.633163 20 to 29 142127 0.7506 0.773549 19 to 28 141992 0.2851 0.612204 18 to 27 141791 -0.4080 0.341624 17 to 26 142074 0.5678 0.714924 16 to 25 142210 1.0368 0.850084 15 to 24 141544 -1.2598 0.103878 14 to 23 141919 0.0333 0.513300 13 to 22 142352 1.5264 0.936551 12 to 21 141896 -0.0460 0.481669 11 to 20 141534 -1.2942 0.097791 10 to 19 141838 -0.2460 0.402855 9 to 18 142314 1.3954 0.918554 8 to 17 141917 0.0264 0.510550 7 to 16 141847 -0.2149 0.414911 6 to 15 142010 0.3471 0.635756 5 to 14 141647 -0.9046 0.182842 4 to 13 141098 -2.7977 0.002573 3 to 12 142173 0.9092 0.818380 2 to 11 141794 -0.3977 0.345430 1 to 10 141761 -0.5115 0.304507 ----------------------------------------------------------------- |------------------------------------------------------------ | | 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. | |------------------------------------------------------------ | OQSO test for mersenn.bin Bits used No. missing words z-score p-value 28 to 32 142243 1.1311 0.870990 27 to 31 142510 2.0362 0.979133 26 to 30 141858 -0.1740 0.430933 25 to 29 141929 0.0667 0.526581 24 to 28 141882 -0.0926 0.463093 23 to 27 141714 -0.6621 0.253942 22 to 26 141809 -0.3401 0.366890 21 to 25 142265 1.2057 0.886026 20 to 24 141751 -0.5367 0.295733 19 to 23 141388 -1.7672 0.038596 18 to 22 142284 1.2701 0.897970 17 to 21 141788 -0.4113 0.340431 16 to 20 141935 0.0870 0.534671 15 to 19 141576 -1.1299 0.129252 14 to 18 141616 -0.9943 0.160029 13 to 17 142220 1.0531 0.853857 12 to 16 141759 -0.5096 0.305168 11 to 15 142213 1.0294 0.848352 10 to 14 142409 1.6938 0.954848 9 to 13 141651 -0.8757 0.190598 8 to 12 141845 -0.2181 0.413688 7 to 11 141903 -0.0215 0.491440 6 to 10 142113 0.6904 0.755031 5 to 9 141959 0.1684 0.566855 4 to 8 141314 -2.0181 0.021792 3 to 7 141887 -0.0757 0.469831 2 to 6 142207 1.0091 0.843525 1 to 5 142553 2.1819 0.985443 ----------------------------------------------------------------- |------------------------------------------------------------ | | 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. | |------------------------------------------------------------ | DNA test for mersenn.bin Bits used No. missing words z-score p-value 31 to 32 142294 1.1347 0.871754 30 to 31 141790 -0.3520 0.362417 29 to 30 142486 1.7011 0.955537 28 to 29 142438 1.5595 0.940561 27 to 28 142213 0.8958 0.814815 26 to 27 141421 -1.4405 0.074863 25 to 26 142344 1.2822 0.900116 24 to 25 142270 1.0639 0.856318 23 to 24 141843 -0.1957 0.422437 22 to 23 141525 -1.1337 0.128457 21 to 22 141848 -0.1809 0.428217 20 to 21 142018 0.3206 0.625728 19 to 20 141748 -0.4759 0.317073 18 to 19 142118 0.6155 0.730903 17 to 18 142206 0.8751 0.809249 16 to 17 142433 1.5447 0.938797 15 to 16 141199 -2.0954 0.018069 14 to 15 142540 1.8604 0.968584 13 to 14 142013 0.3058 0.620126 12 to 13 141936 0.0787 0.531354 11 to 12 142234 0.9577 0.830900 10 to 11 141700 -0.6175 0.268455 9 to 10 142281 1.0964 0.863542 8 to 9 141947 0.1111 0.544240 7 to 8 141546 -1.0718 0.141912 6 to 7 142151 0.7129 0.762043 5 to 6 141288 -1.8328 0.033414 4 to 5 141842 -0.1986 0.421283 3 to 4 142679 2.2704 0.988409 2 to 3 141909 -0.0010 0.499612 1 to 2 141884 -0.0747 0.470219 ----------------------------------------------------------------- |-------------------------------------------------------------| | 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 result COUNT-THE-1's in bytes for mersenn.bin (Degrees of freedom: 5^4-5^3=2500; sample size: 2560000) chisquare z-score p-value 2395.03 -1.484 0.068843 |-------------------------------------------------------------| | 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. | |-------------------------------------------------------------| Test results for specific bytes for mersenn.bin (Degrees of freedom: 5^4-5^3=2500; sample size: 256000) bits used chisquare z-score p-value 1 to 8 2496.35 -0.052 0.479441 2 to 9 2436.40 -0.899 0.184204 3 to 10 2410.44 -1.267 0.102660 4 to 11 2462.45 -0.531 0.297683 5 to 12 2519.79 0.280 0.610202 6 to 13 2425.34 -1.056 0.145516 7 to 14 2563.40 0.897 0.815027 8 to 15 2564.82 0.917 0.820351 9 to 16 2484.66 -0.217 0.414124 10 to 17 2558.79 0.831 0.797116 11 to 18 2649.19 2.110 0.982567 12 to 19 2445.37 -0.773 0.219884 13 to 20 2339.17 -2.274 0.011470 14 to 21 2340.13 -2.261 0.011881 15 to 22 2595.51 1.351 0.911618 16 to 23 2549.70 0.703 0.758921 17 to 24 2593.54 1.323 0.907058 18 to 25 2396.78 -1.460 0.072177 19 to 26 2508.59 0.121 0.548319 20 to 27 2439.41 -0.857 0.195774 21 to 28 2518.46 0.261 0.602976 22 to 29 2385.60 -1.618 0.052852 23 to 30 2513.70 0.194 0.576793 24 to 31 2499.29 -0.010 0.495968 25 to 32 2534.36 0.486 0.686479 |-------------------------------------------------------------| | 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 be approximate| |to normally distributed. Thus (k-3523)/21.9 should serve as | |a standard normal variable, which, converted to a p uniform | |in [0,1), provides input to a KSTEST based on a sample of 10.| |-------------------------------------------------------------| CDPARK for mersenn.bin: result of 10 tests (Of 12000 tries, the average no. of successes should be 3523.0 with sigma=21.9) No. succeses z-score p-value 3533 0.4566 0.676028 3526 0.1370 0.554479 3515 -0.3653 0.357445 3539 0.7306 0.767486 3517 -0.2740 0.392053 3516 -0.3196 0.374623 3542 0.8676 0.807188 3469 -2.4658 0.006836 3519 -0.1826 0.427537 3500 -1.0502 0.146807 Square side=100, avg. no. parked=3517.60 sample std.=20.11 p-value of the KSTEST for those 10 p-values: 0.646205 |-------------------------------------------------------------| | THE MINIMUM DISTANCE TEST | |It does this ten 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 provide a p-value and a| |KSTEST on the resulting 10 values serves as a test of uni- | |formity for those samples of 8000 random points in a square. | |-------------------------------------------------------------| Results for the MINIMUM DISTANCE test for mersenn.bin 0.2845,0.7676,0.9223,0.6765,0.6564,0.7228,0.1432,0.2088,0.5062,0.0108, The KS test for those 10 p-values: 0.933971 |-------------------------------------------------------------| | 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 mersenn.bin sample no r^3 equiv. uni. 1 81.207 0.933256 2 12.699 0.345118 3 28.219 0.609615 4 3.297 0.104082 5 6.854 0.204235 6 16.933 0.431319 7 30.810 0.641920 8 1.576 0.051183 9 6.035 0.182222 10 21.903 0.518146 11 6.727 0.200872 12 11.133 0.310031 13 86.982 0.944944 14 13.175 0.355417 15 33.412 0.671664 16 12.675 0.344590 17 11.077 0.308731 18 12.413 0.338837 19 30.767 0.641409 20 7.684 0.225972 -------------------------------------------------------------- p-value for KS test on those 20 p-values: 0.208892 |-------------------------------------------------------------| | This is the SQUEEZE 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 mersenn.bin Table of standardized frequency counts (obs-exp)^2/exp for j=(1,..,6), 7,...,47,(48,...) 0.6 -0.3 -1.8 -1.3 -0.6 0.2 0.2 -0.5 -0.5 -0.3 -0.0 0.7 0.0 1.8 -0.1 0.5 0.4 -0.4 -1.0 0.3 -0.8 -0.6 0.6 -0.7 -0.5 -0.0 -0.4 0.7 0.6 0.6 -0.6 -0.9 0.3 1.4 0.1 0.2 -1.2 -1.3 -1.2 1.5 0.1 0.0 -0.1 Chi-square with 42 degrees of freedom:25.564857 z-score=-1.793221, p-value=0.021390 _____________________________________________________________ |-------------------------------------------------------------| | 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. | |-------------------------------------------------------------| Results of the OSUM test for mersenn.bin Test no p-value 1 0.054037 2 0.605905 3 0.981796 4 0.744150 5 0.797437 6 0.567171 7 0.249119 8 0.051965 9 0.634660 10 0.957853 _____________________________________________________________ p-value for 10 kstests on 100 sums: 0.485458 |----------------------------------------------------------| |This is the UP-DOWN RUNS test. An up-run of length n has | |x_1<...x_(n+1), while a down-run of length n | |has x_1>...>x_n and x_n=2, the prob. of a run of length k is 2*k/(k+1)!) Length Expected UpRuns (O-E)^2/E DownRuns (O-E)^2/E 2 66666.67 66815 0.33 66680 0.00 3 25000.00 24886 0.52 24824 1.24 4 6666.67 6562 1.64 6784 2.06 5 1388.89 1460 3.64 1430 1.22 6 238.10 233 0.11 232 0.16 7 34.72 35 0.00 43 1.97 8 4.96 8 1.86 6 0.22 p=0.76974 p=0.66717 Number of rngs required: 688568, p-value: 0.575 |-------------------------------------------------------------| |This the CRAPS TEST. It plays 200,000 games of craps, counts| |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), and | |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 mersenn.bin No. of wins: Observed Expected 98795 98585.9 z-score= 0.935, pvalue=0.82521 Analysis of Throws-per-Game: Throws Observed Expected Chisq Sum of (O-E)^2/E 1 66547 66666.7 0.215 0.215 2 37634 37654.3 0.011 0.226 3 26712 26954.7 2.186 2.412 4 19427 19313.5 0.667 3.079 5 14094 13851.4 4.248 7.327 6 9950 9943.5 0.004 7.332 7 7213 7145.0 0.647 7.978 8 5033 5139.1 2.189 10.168 9 3649 3699.9 0.699 10.867 10 2636 2666.3 0.344 11.211 11 2010 1923.3 3.906 15.117 12 1407 1388.7 0.240 15.357 13 971 1003.7 1.066 16.423 14 759 726.1 1.487 17.910 15 559 525.8 2.092 20.002 16 396 381.2 0.579 20.580 17 258 276.5 1.243 21.823 18 194 200.8 0.232 22.056 19 154 146.0 0.440 22.496 20 119 106.2 1.539 24.034 21 278 287.1 0.289 24.324 Chisq= 24.32 for 20 degrees of freedom, p= 0.77147 SUMMARY of craptest p-value for no. of wins: 0.825210 p-value for throws/game: 0.771466 _____________________________________________________________ |-------------------------------------------------------------| |This is the CRAPS TEST with different dice. Each die value is| |determined by the rightmost three bits of the 32-bit random | |integer; values 1 to 6 are accepted, others rejected. As in | |the first test, 200,000 games of craps are played, counting | |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), and | |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. | |-------------------------------------------------------------| RESULTS OF CRAPS TEST2 for mersenn.bin No. of wins: Observed Expected 98644 98585.9 z-score= 0.260, pvalue=0.60258 Analysis of Throws-per-Game: Throws Observed Expected Chisq Sum of (O-E)^2/E 1 66704 66666.7 0.021 0.021 2 37618 37654.3 0.035 0.056 3 27022 26954.7 0.168 0.224 4 19320 19313.5 0.002 0.226 5 13834 13851.4 0.022 0.248 6 9975 9943.5 0.100 0.347 7 7149 7145.0 0.002 0.350 8 5170 5139.1 0.186 0.536 9 3697 3699.9 0.002 0.538 10 2651 2666.3 0.088 0.626 11 1881 1923.3 0.932 1.557 12 1367 1388.7 0.340 1.898 13 959 1003.7 1.992 3.890 14 731 726.1 0.033 3.922 15 518 525.8 0.117 4.039 16 411 381.2 2.338 6.377 17 273 276.5 0.045 6.422 18 180 200.8 2.160 8.582 19 112 146.0 7.911 16.494 20 112 106.2 0.315 16.809 21 316 287.1 2.906 19.715 Chisq= 19.72 for 20 degrees of freedom, p= 0.52412 SUMMARY of craptest p-value for no. of wins: 0.602584 p-value for throws/game: 0.524121 _____________________________________________________________ ***** TEST SUMMARY ***** All p-values: 0.2279,0.6941,0.8926,0.3505,0.7363,0.8400,0.3181,0.6862,0.8859,0.2649, 0.4817,0.6206,0.5208,0.7574,0.5784,0.2172,0.2615,0.6002,0.7671,0.1327, 0.9932,0.0243,0.0837,0.7000,0.4697,0.3028,0.7452,0.8203,0.1797,0.6689, 0.6394,0.9694,0.1860,0.5511,0.8218,0.0459,0.5609,0.4773,0.6705,0.5311, 0.3339,0.4853,0.7808,0.1899,0.4989,0.1477,0.3333,0.9720,0.2842,0.8756, 0.3837,0.2373,0.2514,0.8179,0.4542,0.5216,0.8019,0.7913,0.4606,0.5461, 0.5669,0.7220,0.3839,0.1641,0.6658,0.1333,0.9398,0.5253,0.5432,0.4797, 0.2825,0.7719,0.5974,0.7402,0.2165,0.7749,0.1899,0.2530,0.3211,0.5957, 0.6092,0.0595,0.7724,0.9122,0.3317,0.3074,0.5830,0.2208,0.1274,0.2707, 0.1619,0.4110,0.6762,0.6550,0.9021,0.2977,0.6703,0.6358,0.0485,0.2341, 0.5976,0.6332,0.7735,0.6122,0.3416,0.7149,0.8501,0.1039,0.5133,0.9366, 0.4817,0.0978,0.4029,0.9186,0.5106,0.4149,0.6358,0.1828,0.0026,0.8184, 0.3454,0.3045,0.8710,0.9791,0.4309,0.5266,0.4631,0.2539,0.3669,0.8860, 0.2957,0.0386,0.8980,0.3404,0.5347,0.1293,0.1600,0.8539,0.3052,0.8484, 0.9548,0.1906,0.4137,0.4914,0.7550,0.5669,0.0218,0.4698,0.8435,0.9854, 0.8718,0.3624,0.9555,0.9406,0.8148,0.0749,0.9001,0.8563,0.4224,0.1285, 0.4282,0.6257,0.3171,0.7309,0.8092,0.9388,0.0181,0.9686,0.6201,0.5314, 0.8309,0.2685,0.8635,0.5442,0.1419,0.7620,0.0334,0.4213,0.9884,0.4996, 0.4702,0.0688,0.4794,0.1842,0.1027,0.2977,0.6102,0.1455,0.8150,0.8204, 0.4141,0.7971,0.9826,0.2199,0.0115,0.0119,0.9116,0.7589,0.9071,0.0722, 0.5483,0.1958,0.6030,0.0529,0.5768,0.4960,0.6865,0.6760,0.5545,0.3574, 0.7675,0.3921,0.3746,0.8072,0.0068,0.4275,0.1468,0.6462,0.2845,0.7676, 0.9223,0.6765,0.6564,0.7228,0.1432,0.2088,0.5062,0.0108,0.9340,0.9333, 0.3451,0.6096,0.1041,0.2042,0.4313,0.6419,0.0512,0.1822,0.5181,0.2009, 0.3100,0.9449,0.3554,0.6717,0.3446,0.3087,0.3388,0.6414,0.2260,0.2089, 0.0214,0.0540,0.6059,0.9818,0.7442,0.7974,0.5672,0.2491,0.0520,0.6347, 0.9579,0.4855,0.7697,0.6672,0.5753,0.8252,0.7715,0.6026,0.5241, Overall p-value after applying KStest on 269 p-values = 0.834006 In response to requests, we have provided a list of all the p-values produced by the tests you have chosen for this run. The individual p-values are supposed to be uniform in [0,1), but they are not necessarily independent. So even though we have applied a KSTEST to the accumulated p-values, the result is not necessarily---even if your file contains truly random bits---uniform in [0,1). But it is probably pretty close, so take that last p-value with a grain of salt. In particular, there may be some values so close to 0 or 1 that the tests they came from should be applied several more times, or new, related tests should be undertaken.