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 x (no_bdays=1024, no_days/yr=2^24, lambda=16.00, sample size=500) Bits used mean chisqr p-value 1 to 24 15.60 18.1406 0.619980 2 to 25 15.84 16.6436 0.521247 3 to 26 15.74 23.0069 0.850975 4 to 27 16.02 19.6771 0.708921 5 to 28 15.56 25.4256 0.914419 6 to 29 15.77 23.0378 0.851977 7 to 30 15.57 36.7979 0.996416 8 to 31 15.68 20.7411 0.761916 9 to 32 15.61 19.1585 0.680489 Chisquare degrees of freedom: 17 --------------------------------------------------------------- p-value for KStest on those 9 p-values: 0.007352 |-------------------------------------------------------------| | 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 x: 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 6 40 77 93 95 84 40 39 14 6 6 (O-E)^2/E 1.1 0.3 0.2 0.2 0.1 0.4 2.8 2.9 0.1 0.1 0.9 Birthday Spacings: Sum(O-E)^2/E= 9.027, p= 0.470 |-----------------------------------------------------------| |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 x Euclid's algorithm: p-value, steps to gcd: 0.342814 p-value, dist. of gcd's: 0.314897 |-----------------------------------------------------------| |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 x: Note: lengthy test---for example, ~20 minutes for 850MHz PC Bits 0 to 7---> 0.841 0.315 0.235 0.940 0.553 0.276 0.407 0.742 Bits 8 to 15---> 0.266 0.070 0.295 0.957 0.745 0.120 0.848 0.520 Bits 16 to 23---> 0.432 0.716 0.622 0.989 0.522 0.307 0.840 0.325 Bits 24 to 31---> 0.190 0.478 0.872 0.244 0.651 0.449 0.930 0.053 KS test for the above 32 p values: 0.133 |-------------------------------------------------------------| | THE OVERLAPPING 5-PERMUTATION TEST | |This is the OPERM5 test. It looks at a sequence of two 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 2 million (overlapping) 5-tuples for x, p-values for 5 runs: 0.3902, 0.8589, 0.8241, 0.8297, 0.8246 |-------------------------------------------------------------| |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 x RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=28 204 211.4 0.260 0.260 r= 29 5133 5134.0 0.000 0.260 r= 30 23144 23103.0 0.073 0.333 r= 31 11519 11551.5 0.092 0.425 chi-square = 0.425 with df = 3; p-value = 0.065 -------------------------------------------------------------- |-------------------------------------------------------------| |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 x RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=29 199 211.4 0.729 0.729 r= 30 5194 5134.0 0.701 1.430 r= 31 23016 23103.0 0.328 1.758 r= 32 11591 11551.5 0.135 1.893 chi-square = 1.893 with df = 3; p-value = 0.405 -------------------------------------------------------------- |-------------------------------------------------------------| |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 x b-rank test for bits 1 to 8, p=0.44780 b-rank test for bits 2 to 9, p=0.37328 b-rank test for bits 3 to 10, p=0.02913 b-rank test for bits 4 to 11, p=0.77842 b-rank test for bits 5 to 12, p=0.07472 b-rank test for bits 6 to 13, p=0.61202 b-rank test for bits 7 to 14, p=0.61596 b-rank test for bits 8 to 15, p=0.93902 b-rank test for bits 9 to 16, p=0.74977 b-rank test for bits 10 to 17, p=0.77217 b-rank test for bits 11 to 18, p=0.39382 b-rank test for bits 12 to 19, p=0.54150 b-rank test for bits 13 to 20, p=0.51740 b-rank test for bits 14 to 21, p=0.16399 b-rank test for bits 15 to 22, p=0.35902 b-rank test for bits 16 to 23, p=0.44732 b-rank test for bits 17 to 24, p=0.10651 b-rank test for bits 18 to 25, p=0.23901 b-rank test for bits 19 to 26, p=0.31525 b-rank test for bits 20 to 27, p=0.72590 b-rank test for bits 21 to 28, p=0.01054 b-rank test for bits 22 to 29, p=0.01565 b-rank test for bits 23 to 30, p=0.41909 b-rank test for bits 24 to 31, p=0.67323 b-rank test for bits 25 to 32, p=0.98912 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.549243 |-------------------------------------------------------------| | 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 x (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 142597 1.61 0.945941 2 142325 0.97 0.834274 3 141191 -1.68 0.046640 4 141779 -0.30 0.380370 5 141892 -0.04 0.483851 6 142110 0.47 0.680413 7 141701 -0.49 0.313217 8 142425 1.20 0.885867 9 141909 -0.00 0.499692 10 141752 -0.37 0.356588 11 142221 0.73 0.766755 12 141193 -1.67 0.047098 13 141122 -1.84 0.032917 14 142090 0.42 0.663534 15 142366 1.07 0.857011 16 141987 0.18 0.572001 17 141929 0.05 0.518328 18 141747 -0.38 0.352242 19 142964 2.46 0.993134 20 141910 0.00 0.500625 ---------------------------------------------------------------- |-------------------------------------------------------------| | 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 x Bits used No. missing words z-score p-value 23 to 32 141696 -0.7356 0.230981 22 to 31 141791 -0.4080 0.341624 21 to 30 141334 -1.9839 0.023634 20 to 29 141824 -0.2942 0.384287 19 to 28 142299 1.3437 0.910476 18 to 27 142244 1.1540 0.875757 17 to 26 142131 0.7644 0.777679 16 to 25 141644 -0.9149 0.180114 15 to 24 141383 -1.8149 0.034767 14 to 23 141674 -0.8115 0.208544 13 to 22 142025 0.3989 0.655003 12 to 21 142424 1.7747 0.962028 11 to 20 141898 -0.0391 0.484418 10 to 19 141445 -1.6011 0.054673 9 to 18 141876 -0.1149 0.454250 8 to 17 141798 -0.3839 0.350528 7 to 16 141797 -0.3873 0.349251 6 to 15 141774 -0.4667 0.320373 5 to 14 141853 -0.1942 0.422994 4 to 13 141980 0.2437 0.596264 3 to 12 141286 -2.1494 0.015801 2 to 11 141823 -0.2977 0.382970 1 to 10 141555 -1.2218 0.110886 ----------------------------------------------------------------- |------------------------------------------------------------ | | 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 x Bits used No. missing words z-score p-value 28 to 32 142081 0.5819 0.719694 27 to 31 141886 -0.0791 0.468483 26 to 30 142317 1.3819 0.916504 25 to 29 141436 -1.6045 0.054301 24 to 28 142015 0.3582 0.639905 23 to 27 140947 -3.2621 0.000553 22 to 26 141558 -1.1909 0.116837 21 to 25 141739 -0.5774 0.281838 20 to 24 141778 -0.4452 0.328093 19 to 23 142156 0.8362 0.798470 18 to 22 141981 0.2429 0.595978 17 to 21 141617 -0.9909 0.160855 16 to 20 141488 -1.4282 0.076612 15 to 19 141900 -0.0316 0.487385 14 to 18 141962 0.1785 0.570852 13 to 17 142695 2.6633 0.996131 12 to 16 142379 1.5921 0.944319 11 to 15 141903 -0.0215 0.491440 10 to 14 142027 0.3989 0.655010 9 to 13 141864 -0.1537 0.438939 8 to 12 141758 -0.5130 0.303982 7 to 11 141643 -0.9028 0.183312 6 to 10 142168 0.8768 0.809715 5 to 9 141352 -1.8893 0.029429 4 to 8 141573 -1.1401 0.127122 3 to 7 141940 0.1040 0.541402 2 to 6 141728 -0.6147 0.269384 1 to 5 142076 0.5650 0.713957 ----------------------------------------------------------------- |------------------------------------------------------------ | | 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 x Bits used No. missing words z-score p-value 31 to 32 142353 1.3088 0.904692 30 to 31 141749 -0.4729 0.318125 29 to 30 142078 0.4976 0.690600 28 to 29 141941 0.0934 0.537216 27 to 28 141353 -1.6411 0.050389 26 to 27 141756 -0.4523 0.325526 25 to 26 142380 1.3884 0.917493 24 to 25 142325 1.2262 0.889932 23 to 24 141138 -2.2753 0.011444 22 to 23 141419 -1.4464 0.074032 21 to 22 141806 -0.3048 0.380256 20 to 21 141997 0.2586 0.602033 19 to 20 140962 -2.7945 0.002599 18 to 19 142385 1.4032 0.919715 17 to 18 141495 -1.2222 0.110814 16 to 17 141364 -1.6086 0.053847 15 to 16 141898 -0.0334 0.486669 14 to 15 142086 0.5212 0.698869 13 to 14 142463 1.6332 0.948791 12 to 13 142318 1.2055 0.885998 11 to 12 141975 0.1937 0.576801 10 to 11 141933 0.0698 0.527833 9 to 10 141937 0.0816 0.532527 8 to 9 141670 -0.7060 0.240098 7 to 8 141427 -1.4228 0.077397 6 to 7 142054 0.4268 0.665221 5 to 6 142137 0.6716 0.749079 4 to 5 141467 -1.3048 0.095979 3 to 4 141987 0.2291 0.590610 2 to 3 141711 -0.5850 0.279259 1 to 2 141298 -1.8033 0.035668 ----------------------------------------------------------------- |-------------------------------------------------------------| | 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 x (Degrees of freedom: 5^4-5^3=2500; sample size: 2560000) chisquare z-score p-value 2434.72 -0.923 0.177944 |-------------------------------------------------------------| | 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 x (Degrees of freedom: 5^4-5^3=2500; sample size: 256000) bits used chisquare z-score p-value 1 to 8 2514.79 0.209 0.582815 2 to 9 2461.89 -0.539 0.294949 3 to 10 2531.61 0.447 0.672576 4 to 11 2529.05 0.411 0.659415 5 to 12 2522.08 0.312 0.622585 6 to 13 2317.57 -2.580 0.004940 7 to 14 2487.78 -0.173 0.431409 8 to 15 2468.89 -0.440 0.329983 9 to 16 2564.43 0.911 0.818887 10 to 17 2439.03 -0.862 0.194264 11 to 18 2535.90 0.508 0.694188 12 to 19 2526.12 0.369 0.644065 13 to 20 2391.60 -1.533 0.062645 14 to 21 2485.44 -0.206 0.418408 15 to 22 2492.85 -0.101 0.459750 16 to 23 2577.14 1.091 0.862333 17 to 24 2612.04 1.585 0.943463 18 to 25 2354.91 -2.052 0.020088 19 to 26 2596.15 1.360 0.913043 20 to 27 2399.64 -1.419 0.077905 21 to 28 2499.15 -0.012 0.495197 22 to 29 2362.95 -1.938 0.026300 23 to 30 2479.48 -0.290 0.385813 24 to 31 2458.20 -0.591 0.277213 25 to 32 2589.38 1.264 0.896883 |-------------------------------------------------------------| | 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 x: 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 3531 0.3653 0.642555 3546 1.0502 0.853193 3516 -0.3196 0.374623 3512 -0.5023 0.307734 3480 -1.9635 0.024796 3533 0.4566 0.676028 3517 -0.2740 0.392053 3518 -0.2283 0.409702 3574 2.3288 0.990064 3517 -0.2740 0.392053 Square side=100, avg. no. parked=3524.40 sample std.=23.22 p-value of the KSTEST for those 10 p-values: 0.735195 |-------------------------------------------------------------| | 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 x 0.4205,0.7014,0.0685,0.7442,0.5703,0.9203,0.2730,0.7203,0.7270,0.1377, The KS test for those 10 p-values: 0.875179 |-------------------------------------------------------------| | 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 x sample no r^3 equiv. uni. 1 47.343 0.793631 2 13.753 0.367726 3 11.105 0.309384 4 30.538 0.638663 5 19.255 0.473675 6 4.684 0.144558 7 1.938 0.062552 8 42.743 0.759438 9 111.898 0.976006 10 10.192 0.288029 11 27.933 0.605877 12 56.081 0.845780 13 34.502 0.683384 14 4.523 0.139946 15 2.688 0.085703 16 17.046 0.433448 17 10.568 0.296913 18 39.675 0.733536 19 22.772 0.531895 20 54.637 0.838172 -------------------------------------------------------------- p-value for KS test on those 20 p-values: 0.992633 |-------------------------------------------------------------| | 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 x Table of standardized frequency counts (obs-exp)^2/exp for j=(1,..,6), 7,...,47,(48,...) -0.8 0.5 1.1 -0.7 1.4 -1.5 -0.6 -1.7 2.2 0.9 0.0 1.2 0.5 -0.6 -0.1 -0.7 0.5 -0.2 0.8 -0.3 0.6 -1.3 -1.0 0.3 0.5 0.9 -0.4 -0.5 -0.1 -0.4 0.6 -1.3 -0.5 -1.7 -0.6 -0.8 0.0 -0.1 1.3 -0.1 -0.6 1.0 -0.1 Chi-square with 42 degrees of freedom:33.552857 z-score=-0.921659, p-value=0.179367 _____________________________________________________________ |-------------------------------------------------------------| | 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 x Test no p-value 1 0.919563 2 0.278948 3 0.928541 4 0.221085 5 0.165363 6 0.172271 7 0.013469 8 0.447420 9 0.039510 10 0.025806 _____________________________________________________________ p-value for 10 kstests on 100 sums: 0.023255 |----------------------------------------------------------| |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 66680 0.00 66578 0.12 3 25000.00 24925 0.23 25137 0.75 4 6666.67 6766 1.48 6638 0.12 5 1388.89 1369 0.28 1344 1.45 6 238.10 215 2.24 259 1.84 7 34.72 38 0.31 40 0.80 8 4.96 6 0.22 3 0.77 p=0.42514 p=0.56046 Number of rngs required: 687649, p-value: 0.192 |-------------------------------------------------------------| |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 x No. of wins: Observed Expected 99046 98585.9 z-score= 2.058, pvalue=0.98021 Analysis of Throws-per-Game: Throws Observed Expected Chisq Sum of (O-E)^2/E 1 66927 66666.7 1.017 1.017 2 37625 37654.3 0.023 1.039 3 27006 26954.7 0.098 1.137 4 19194 19313.5 0.739 1.876 5 13869 13851.4 0.022 1.898 6 10021 9943.5 0.603 2.502 7 7076 7145.0 0.667 3.168 8 5049 5139.1 1.579 4.747 9 3654 3699.9 0.569 5.316 10 2617 2666.3 0.911 6.227 11 1897 1923.3 0.360 6.588 12 1380 1388.7 0.055 6.643 13 1025 1003.7 0.451 7.094 14 706 726.1 0.559 7.653 15 507 525.8 0.675 8.327 16 373 381.2 0.174 8.502 17 292 276.5 0.864 9.366 18 212 200.8 0.621 9.987 19 150 146.0 0.110 10.098 20 108 106.2 0.030 10.128 21 312 287.1 2.157 12.285 Chisq= 12.28 for 20 degrees of freedom, p= 0.09407 SUMMARY of craptest p-value for no. of wins: 0.980206 p-value for throws/game: 0.094070 _____________________________________________________________ |-------------------------------------------------------------| |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 x No. of wins: Observed Expected 98581 98585.9 z-score=-0.022, pvalue=0.49133 Analysis of Throws-per-Game: Throws Observed Expected Chisq Sum of (O-E)^2/E 1 66688 66666.7 0.007 0.007 2 37541 37654.3 0.341 0.348 3 26911 26954.7 0.071 0.419 4 19380 19313.5 0.229 0.648 5 13697 13851.4 1.722 2.370 6 10220 9943.5 7.686 10.056 7 6951 7145.0 5.269 15.325 8 5240 5139.1 1.982 17.307 9 3667 3699.9 0.292 17.599 10 2777 2666.3 4.596 22.195 11 1922 1923.3 0.001 22.196 12 1365 1388.7 0.406 22.602 13 1009 1003.7 0.028 22.630 14 716 726.1 0.142 22.771 15 526 525.8 0.000 22.771 16 379 381.2 0.012 22.783 17 256 276.5 1.526 24.309 18 204 200.8 0.050 24.359 19 157 146.0 0.831 25.190 20 113 106.2 0.433 25.624 21 281 287.1 0.130 25.754 Chisq= 25.75 for 20 degrees of freedom, p= 0.82590 SUMMARY of craptest p-value for no. of wins: 0.491331 p-value for throws/game: 0.825901 _____________________________________________________________ ***** TEST SUMMARY ***** All p-values: 0.6200,0.5212,0.8510,0.7089,0.9144,0.8520,0.9964,0.7619,0.6805,0.0074, 0.4704,0.3428,0.3149,0.8408,0.3150,0.2351,0.9398,0.5532,0.2763,0.4069, 0.7423,0.2659,0.0698,0.2947,0.9566,0.7445,0.1198,0.8479,0.5202,0.4325, 0.7164,0.6216,0.9890,0.5215,0.3066,0.8398,0.3248,0.1901,0.4776,0.8717, 0.2441,0.6510,0.4488,0.9304,0.0531,0.1327,0.3902,0.8589,0.8241,0.8297, 0.8246,0.0649,0.4051,0.4478,0.3733,0.0291,0.7784,0.0747,0.6120,0.6160, 0.9390,0.7498,0.7722,0.3938,0.5415,0.5174,0.1640,0.3590,0.4473,0.1065, 0.2390,0.3153,0.7259,0.0105,0.0156,0.4191,0.6732,0.9891,0.5492,0.9459, 0.8343,0.0466,0.3804,0.4839,0.6804,0.3132,0.8859,0.4997,0.3566,0.7668, 0.0471,0.0329,0.6635,0.8570,0.5720,0.5183,0.3522,0.9931,0.5006,0.2310, 0.3416,0.0236,0.3843,0.9105,0.8758,0.7777,0.1801,0.0348,0.2085,0.6550, 0.9620,0.4844,0.0547,0.4542,0.3505,0.3493,0.3204,0.4230,0.5963,0.0158, 0.3830,0.1109,0.7197,0.4685,0.9165,0.0543,0.6399,0.0006,0.1168,0.2818, 0.3281,0.7985,0.5960,0.1609,0.0766,0.4874,0.5709,0.9961,0.9443,0.4914, 0.6550,0.4389,0.3040,0.1833,0.8097,0.0294,0.1271,0.5414,0.2694,0.7140, 0.9047,0.3181,0.6906,0.5372,0.0504,0.3255,0.9175,0.8899,0.0114,0.0740, 0.3803,0.6020,0.0026,0.9197,0.1108,0.0538,0.4867,0.6989,0.9488,0.8860, 0.5768,0.5278,0.5325,0.2401,0.0774,0.6652,0.7491,0.0960,0.5906,0.2793, 0.0357,0.1779,0.5828,0.2949,0.6726,0.6594,0.6226,0.0049,0.4314,0.3300, 0.8189,0.1943,0.6942,0.6441,0.0626,0.4184,0.4597,0.8623,0.9435,0.0201, 0.9130,0.0779,0.4952,0.0263,0.3858,0.2772,0.8969,0.6426,0.8532,0.3746, 0.3077,0.0248,0.6760,0.3921,0.4097,0.9901,0.3921,0.7352,0.4205,0.7014, 0.0685,0.7442,0.5703,0.9203,0.2730,0.7203,0.7270,0.1377,0.8752,0.7936, 0.3677,0.3094,0.6387,0.4737,0.1446,0.0626,0.7594,0.9760,0.2880,0.6059, 0.8458,0.6834,0.1399,0.0857,0.4334,0.2969,0.7335,0.5319,0.8382,0.9926, 0.1794,0.9196,0.2789,0.9285,0.2211,0.1654,0.1723,0.0135,0.4474,0.0395, 0.0258,0.0233,0.4251,0.5605,0.1916,0.9802,0.0941,0.4913,0.8259, Overall p-value after applying KStest on 269 p-values = 0.175827 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.