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 B7-4_12M.1 (no_bdays=1024, no_days/yr=2^24, lambda=16.00, sample size=500) Bits used mean chisqr p-value 1 to 24 15.86 26.1100 0.927521 2 to 25 15.77 11.0324 0.145127 3 to 26 16.12 19.0805 0.676066 4 to 27 15.96 23.7748 0.874315 5 to 28 15.70 18.8359 0.661968 6 to 29 15.50 19.5704 0.703207 7 to 30 15.58 21.4035 0.791241 8 to 31 15.83 28.7705 0.963298 9 to 32 15.95 17.0822 0.551187 Chisquare degrees of freedom: 17 --------------------------------------------------------------- p-value for KStest on those 9 p-values: 0.057444 |-------------------------------------------------------------| | 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 B7-4_12M.1: 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 11 32 70 100 103 81 48 26 14 13 2 (O-E)^2/E 0.4 0.6 0.1 0.1 0.3 0.1 0.3 0.5 0.1 6.2 1.0 Birthday Spacings: Sum(O-E)^2/E= 9.613, p= 0.525 |-----------------------------------------------------------| |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 B7-4_12M.1 Euclid's algorithm: p-value, steps to gcd: 0.898102 p-value, dist. of gcd's: 0.046264 |-----------------------------------------------------------| |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 B7-4_12M.1: Note: lengthy test---for example, ~20 minutes for 850MHz PC Bits 0 to 7---> 0.828 0.429 0.616 0.686 0.610 0.993 0.650 0.121 Bits 8 to 15---> 0.916 0.912 0.914 0.738 0.293 0.155 0.057 0.924 Bits 16 to 23---> 0.831 0.097 0.370 0.692 0.907 0.962 0.378 0.977 Bits 24 to 31---> 0.814 0.954 0.451 0.650 0.316 0.208 0.458 0.499 KS test for the above 32 p values: 0.955 |-------------------------------------------------------------| | 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 B7-4_12M.1, p-values for 5 runs: 0.1737, 0.4394, 0.6553, 0.0797, 0.3617 |-------------------------------------------------------------| |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 B7-4_12M.1 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=28 230 211.4 1.633 1.633 r= 29 5201 5134.0 0.874 2.507 r= 30 22875 23103.0 2.251 4.758 r= 31 11694 11551.5 1.757 6.516 chi-square = 6.516 with df = 3; p-value = 0.911 -------------------------------------------------------------- |-------------------------------------------------------------| |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 B7-4_12M.1 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=29 186 211.4 3.056 3.056 r= 30 5096 5134.0 0.281 3.337 r= 31 23182 23103.0 0.270 3.607 r= 32 11536 11551.5 0.021 3.628 chi-square = 3.628 with df = 3; p-value = 0.695 -------------------------------------------------------------- |-------------------------------------------------------------| |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 B7-4_12M.1 b-rank test for bits 1 to 8, p=0.59856 b-rank test for bits 2 to 9, p=0.73360 b-rank test for bits 3 to 10, p=0.51325 b-rank test for bits 4 to 11, p=0.82251 b-rank test for bits 5 to 12, p=0.84603 b-rank test for bits 6 to 13, p=0.30695 b-rank test for bits 7 to 14, p=0.96371 b-rank test for bits 8 to 15, p=0.23845 b-rank test for bits 9 to 16, p=0.11864 b-rank test for bits 10 to 17, p=0.77646 b-rank test for bits 11 to 18, p=0.56852 b-rank test for bits 12 to 19, p=0.66528 b-rank test for bits 13 to 20, p=0.21662 b-rank test for bits 14 to 21, p=0.22046 b-rank test for bits 15 to 22, p=0.40350 b-rank test for bits 16 to 23, p=0.86012 b-rank test for bits 17 to 24, p=0.54187 b-rank test for bits 18 to 25, p=0.31721 b-rank test for bits 19 to 26, p=0.22672 b-rank test for bits 20 to 27, p=0.93853 b-rank test for bits 21 to 28, p=0.00161 b-rank test for bits 22 to 29, p=0.49549 b-rank test for bits 23 to 30, p=0.09125 b-rank test for bits 24 to 31, p=0.23404 b-rank test for bits 25 to 32, p=0.13920 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.889267 |-------------------------------------------------------------| | 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 B7-4_12M.1 (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 141545 -0.85 0.197319 2 142029 0.28 0.610109 3 141802 -0.25 0.400996 4 142104 0.45 0.675387 5 141672 -0.55 0.289615 6 142292 0.89 0.814363 7 141932 0.05 0.521121 8 142117 0.49 0.686236 9 142048 0.32 0.627029 10 142024 0.27 0.605620 11 142048 0.32 0.627029 12 142117 0.49 0.686236 13 141481 -1.00 0.158469 14 142146 0.55 0.709857 15 142275 0.85 0.803550 16 141937 0.06 0.525774 17 141453 -1.07 0.143169 18 141907 -0.01 0.497828 19 141557 -0.82 0.205197 20 141523 -0.90 0.183358 ---------------------------------------------------------------- |-------------------------------------------------------------| | 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 B7-4_12M.1 Bits used No. missing words z-score p-value 23 to 32 141666 -0.8391 0.200715 22 to 31 141853 -0.1942 0.422994 21 to 30 141773 -0.4701 0.319141 20 to 29 142057 0.5092 0.694696 19 to 28 142142 0.8023 0.788813 18 to 27 142201 1.0058 0.842734 17 to 26 141792 -0.4046 0.342891 16 to 25 141342 -1.9563 0.025214 15 to 24 141728 -0.6253 0.265895 14 to 23 142684 2.6713 0.996222 13 to 22 142146 0.8161 0.792780 12 to 21 141973 0.2196 0.586890 11 to 20 141802 -0.3701 0.355653 10 to 19 141621 -0.9942 0.160053 9 to 18 141630 -0.9632 0.167722 8 to 17 142098 0.6506 0.742343 7 to 16 142288 1.3058 0.904183 6 to 15 141851 -0.2011 0.420295 5 to 14 142270 1.2437 0.893193 4 to 13 141875 -0.1184 0.452884 3 to 12 141845 -0.2218 0.412224 2 to 11 141621 -0.9942 0.160053 1 to 10 142135 0.7782 0.781766 ----------------------------------------------------------------- |------------------------------------------------------------ | | 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 B7-4_12M.1 Bits used No. missing words z-score p-value 28 to 32 141788 -0.4113 0.340431 27 to 31 142148 0.8091 0.790757 26 to 30 141317 -2.0079 0.022327 25 to 29 141685 -0.7604 0.223496 24 to 28 141741 -0.5706 0.284132 23 to 27 142107 0.6701 0.748593 22 to 26 142356 1.5141 0.935004 21 to 25 141819 -0.3062 0.379725 20 to 24 142066 0.5311 0.702320 19 to 23 141878 -0.1062 0.457711 18 to 22 141542 -1.2452 0.106532 17 to 21 141898 -0.0384 0.484682 16 to 20 141984 0.2531 0.599912 15 to 19 141551 -1.2147 0.112244 14 to 18 141787 -0.4147 0.339189 13 to 17 141659 -0.8486 0.198059 12 to 16 142062 0.5175 0.697605 11 to 15 141906 -0.0113 0.495497 10 to 14 142131 0.7514 0.773801 9 to 13 141823 -0.2926 0.384897 8 to 12 142021 0.3785 0.647486 7 to 11 141815 -0.3198 0.374574 6 to 10 142064 0.5243 0.699967 5 to 9 142200 0.9853 0.837767 4 to 8 141685 -0.7604 0.223496 3 to 7 142110 0.6802 0.751823 2 to 6 142062 0.5175 0.697605 1 to 5 141930 0.0701 0.527930 ----------------------------------------------------------------- |------------------------------------------------------------ | | 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 B7-4_12M.1 Bits used No. missing words z-score p-value 31 to 32 142024 0.3383 0.632416 30 to 31 141984 0.2203 0.587168 29 to 30 142076 0.4917 0.688517 28 to 29 142410 1.4769 0.930149 27 to 28 141372 -1.5850 0.056478 26 to 27 142745 2.4651 0.993151 25 to 26 141931 0.0639 0.525484 24 to 25 141904 -0.0157 0.493728 23 to 24 141863 -0.1367 0.445647 22 to 23 141638 -0.8004 0.211744 21 to 22 141465 -1.3107 0.094978 20 to 21 142181 0.8014 0.788546 19 to 20 142003 0.2763 0.608846 18 to 19 142614 2.0787 0.981176 17 to 18 141925 0.0462 0.518434 16 to 17 141544 -1.0777 0.140591 15 to 16 141863 -0.1367 0.445647 14 to 15 142363 1.3383 0.909594 13 to 14 142558 1.9135 0.972157 12 to 13 141923 0.0403 0.516083 11 to 12 141832 -0.2281 0.409780 10 to 11 141948 0.1141 0.545409 9 to 10 141920 0.0315 0.512555 8 to 9 141278 -1.8623 0.031278 7 to 8 142320 1.2114 0.887132 6 to 7 141846 -0.1868 0.425903 5 to 6 141206 -2.0747 0.019006 4 to 5 142415 1.4917 0.932105 3 to 4 141955 0.1347 0.553583 2 to 3 141769 -0.4140 0.339454 1 to 2 142017 0.3176 0.624610 ----------------------------------------------------------------- |-------------------------------------------------------------| | 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 B7-4_12M.1 (Degrees of freedom: 5^4-5^3=2500; sample size: 2560000) chisquare z-score p-value 2544.30 0.626 0.734495 |-------------------------------------------------------------| | 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 B7-4_12M.1 (Degrees of freedom: 5^4-5^3=2500; sample size: 256000) bits used chisquare z-score p-value 1 to 8 2424.17 -1.072 0.141765 2 to 9 2453.78 -0.654 0.256665 3 to 10 2398.96 -1.429 0.076514 4 to 11 2594.05 1.330 0.908249 5 to 12 2440.03 -0.848 0.198183 6 to 13 2437.16 -0.889 0.187074 7 to 14 2590.65 1.282 0.900065 8 to 15 2425.71 -1.051 0.146702 9 to 16 2444.93 -0.779 0.218042 10 to 17 2485.85 -0.200 0.420706 11 to 18 2496.65 -0.047 0.481093 12 to 19 2540.55 0.573 0.716824 13 to 20 2584.84 1.200 0.884893 14 to 21 2634.38 1.900 0.971309 15 to 22 2556.60 0.800 0.788263 16 to 23 2522.61 0.320 0.625430 17 to 24 2480.35 -0.278 0.390552 18 to 25 2579.80 1.129 0.870457 19 to 26 2570.09 0.991 0.839209 20 to 27 2573.06 1.033 0.849236 21 to 28 2507.22 0.102 0.540673 22 to 29 2429.27 -1.000 0.158598 23 to 30 2452.90 -0.666 0.252682 24 to 31 2398.10 -1.441 0.074781 25 to 32 2438.21 -0.874 0.191110 |-------------------------------------------------------------| | 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 B7-4_12M.1: 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 3495 -1.2785 0.100530 3521 -0.0913 0.463617 3509 -0.6393 0.261324 3554 1.4155 0.921543 3519 -0.1826 0.427537 3507 -0.7306 0.232514 3523 0.0000 0.500000 3529 0.2740 0.607947 3518 -0.2283 0.409702 3534 0.5023 0.692266 Square side=100, avg. no. parked=3520.90 sample std.=15.35 p-value of the KSTEST for those 10 p-values: 0.718548 |-------------------------------------------------------------| | 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 B7-4_12M.1 0.4118,0.0388,0.3901,0.9908,0.1693,0.5278,0.0562,0.0455,0.6594,0.2463, The KS test for those 10 p-values: 0.111655 |-------------------------------------------------------------| | 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 B7-4_12M.1 sample no r^3 equiv. uni. 1 103.717 0.968483 2 45.527 0.780756 3 38.278 0.720830 4 51.239 0.818766 5 3.229 0.102037 6 22.444 0.526754 7 0.223 0.007422 8 9.768 0.277912 9 15.011 0.393689 10 59.476 0.862279 11 18.914 0.467664 12 32.215 0.658300 13 34.175 0.679919 14 22.162 0.522286 15 12.883 0.349115 16 22.641 0.529845 17 23.850 0.548413 18 75.516 0.919314 19 29.262 0.622954 20 7.953 0.232880 -------------------------------------------------------------- p-value for KS test on those 20 p-values: 0.655756 |-------------------------------------------------------------| | 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 B7-4_12M.1 Table of standardized frequency counts (obs-exp)^2/exp for j=(1,..,6), 7,...,47,(48,...) -0.1 1.3 -0.8 0.6 2.3 1.0 1.9 -1.1 -0.6 -0.7 0.7 0.1 1.1 0.2 -0.4 -1.0 0.2 0.2 -1.4 -0.5 0.6 0.2 0.3 0.7 1.1 0.1 -0.5 -0.4 -0.7 0.2 -0.5 -0.2 -1.1 -0.9 0.3 0.8 -0.2 0.8 0.5 -1.8 0.1 1.0 -0.1 Chi-square with 42 degrees of freedom:31.526398 z-score=-1.142764, p-value=0.118984 _____________________________________________________________ |-------------------------------------------------------------| | 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 B7-4_12M.1 Test no p-value 1 0.282338 2 0.094958 3 0.619320 4 0.005324 5 0.796188 6 0.459778 7 0.942950 8 0.021223 9 0.076473 10 0.768466 _____________________________________________________________ p-value for 10 kstests on 100 sums: 0.174324 |----------------------------------------------------------| |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 66622 0.03 66676 0.00 3 25000.00 25028 0.03 24982 0.01 4 6666.67 6714 0.34 6704 0.21 5 1388.89 1376 0.12 1371 0.23 6 238.10 222 1.09 226 0.61 7 34.72 32 0.21 37 0.15 8 4.96 5 0.00 3 0.77 p=0.06438 p=0.07960 Number of rngs required: 689358, p-value: 0.866 |-------------------------------------------------------------| |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 B7-4_12M.1 No. of wins: Observed Expected 98273 98585.9 z-score=-1.399, pvalue=0.08086 Analysis of Throws-per-Game: Throws Observed Expected Chisq Sum of (O-E)^2/E 1 66580 66666.7 0.113 0.113 2 37440 37654.3 1.220 1.333 3 26923 26954.7 0.037 1.370 4 19260 19313.5 0.148 1.518 5 13907 13851.4 0.223 1.741 6 10186 9943.5 5.912 7.653 7 7147 7145.0 0.001 7.653 8 5212 5139.1 1.035 8.688 9 3636 3699.9 1.102 9.791 10 2675 2666.3 0.028 9.819 11 1970 1923.3 1.133 10.952 12 1397 1388.7 0.049 11.001 13 1017 1003.7 0.176 11.177 14 747 726.1 0.599 11.776 15 550 525.8 1.110 12.886 16 391 381.2 0.255 13.141 17 260 276.5 0.989 14.130 18 178 200.8 2.595 16.725 19 141 146.0 0.170 16.895 20 116 106.2 0.901 17.797 21 267 287.1 1.409 19.206 Chisq= 19.21 for 20 degrees of freedom, p= 0.49152 SUMMARY of craptest p-value for no. of wins: 0.080864 p-value for throws/game: 0.491516 _____________________________________________________________ |-------------------------------------------------------------| |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 B7-4_12M.1 No. of wins: Observed Expected 98854 98585.9 z-score= 1.199, pvalue=0.88479 Analysis of Throws-per-Game: Throws Observed Expected Chisq Sum of (O-E)^2/E 1 66888 66666.7 0.735 0.735 2 37724 37654.3 0.129 0.864 3 27010 26954.7 0.113 0.977 4 19239 19313.5 0.287 1.264 5 13893 13851.4 0.125 1.389 6 9812 9943.5 1.740 3.129 7 7084 7145.0 0.521 3.650 8 5031 5139.1 2.273 5.923 9 3689 3699.9 0.032 5.955 10 2640 2666.3 0.259 6.214 11 1952 1923.3 0.427 6.642 12 1369 1388.7 0.281 6.922 13 1024 1003.7 0.410 7.332 14 718 726.1 0.091 7.424 15 491 525.8 2.308 9.731 16 398 381.2 0.745 10.476 17 294 276.5 1.102 11.579 18 195 200.8 0.169 11.748 19 153 146.0 0.337 12.085 20 122 106.2 2.346 14.431 21 274 287.1 0.599 15.030 Chisq= 15.03 for 20 degrees of freedom, p= 0.22530 SUMMARY of craptest p-value for no. of wins: 0.884791 p-value for throws/game: 0.225304 _____________________________________________________________ ***** TEST SUMMARY ***** All p-values: 0.9275,0.1451,0.6761,0.8743,0.6620,0.7032,0.7912,0.9633,0.5512,0.0574, 0.5250,0.8981,0.0463,0.8275,0.4288,0.6156,0.6864,0.6097,0.9933,0.6504, 0.1215,0.9158,0.9122,0.9137,0.7377,0.2933,0.1549,0.0575,0.9242,0.8312, 0.0971,0.3699,0.6919,0.9067,0.9624,0.3782,0.9766,0.8135,0.9545,0.4510, 0.6502,0.3159,0.2075,0.4584,0.4992,0.9548,0.1737,0.4394,0.6553,0.0797, 0.3617,0.9110,0.6955,0.5986,0.7336,0.5133,0.8225,0.8460,0.3069,0.9637, 0.2384,0.1186,0.7765,0.5685,0.6653,0.2166,0.2205,0.4035,0.8601,0.5419, 0.3172,0.2267,0.9385,0.0016,0.4955,0.0912,0.2340,0.1392,0.8893,0.1973, 0.6101,0.4010,0.6754,0.2896,0.8144,0.5211,0.6862,0.6270,0.6056,0.6270, 0.6862,0.1585,0.7099,0.8035,0.5258,0.1432,0.4978,0.2052,0.1834,0.2007, 0.4230,0.3191,0.6947,0.7888,0.8427,0.3429,0.0252,0.2659,0.9962,0.7928, 0.5869,0.3557,0.1601,0.1677,0.7423,0.9042,0.4203,0.8932,0.4529,0.4122, 0.1601,0.7818,0.3404,0.7908,0.0223,0.2235,0.2841,0.7486,0.9350,0.3797, 0.7023,0.4577,0.1065,0.4847,0.5999,0.1122,0.3392,0.1981,0.6976,0.4955, 0.7738,0.3849,0.6475,0.3746,0.7000,0.8378,0.2235,0.7518,0.6976,0.5279, 0.6324,0.5872,0.6885,0.9301,0.0565,0.9932,0.5255,0.4937,0.4456,0.2117, 0.0950,0.7885,0.6088,0.9812,0.5184,0.1406,0.4456,0.9096,0.9722,0.5161, 0.4098,0.5454,0.5126,0.0313,0.8871,0.4259,0.0190,0.9321,0.5536,0.3395, 0.6246,0.7345,0.1418,0.2567,0.0765,0.9082,0.1982,0.1871,0.9001,0.1467, 0.2180,0.4207,0.4811,0.7168,0.8849,0.9713,0.7883,0.6254,0.3906,0.8705, 0.8392,0.8492,0.5407,0.1586,0.2527,0.0748,0.1911,0.1005,0.4636,0.2613, 0.9215,0.4275,0.2325,0.5000,0.6079,0.4097,0.6923,0.7185,0.4118,0.0388, 0.3901,0.9908,0.1693,0.5278,0.0562,0.0455,0.6594,0.2463,0.1117,0.9685, 0.7808,0.7208,0.8188,0.1020,0.5268,0.0074,0.2779,0.3937,0.8623,0.4677, 0.6583,0.6799,0.5223,0.3491,0.5298,0.5484,0.9193,0.6230,0.2329,0.6558, 0.1190,0.2823,0.0950,0.6193,0.0053,0.7962,0.4598,0.9429,0.0212,0.0765, 0.7685,0.1743,0.0644,0.0796,0.8661,0.0809,0.4915,0.8848,0.2253, Overall p-value after applying KStest on 269 p-values = 0.904359 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.