|-------------------------------------------------------------| | 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 integers in the specified file. Then the| |file is closed and reopened, then bits 2-25 of the same inte-| |gers 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 TEST FOR dump3 (no_bdays=1024, no_days/yr=2^24, lambda=16.00, sample size=500) Bits used mean chisqr p-value 1 to 24 15.78 15.5815 0.553670 2 to 25 15.89 25.9719 0.074973 3 to 26 15.60 24.2449 0.112933 4 to 27 15.50 20.8898 0.231258 5 to 28 15.71 18.7916 0.340625 6 to 29 16.04 9.8290 0.910626 7 to 30 15.67 11.3182 0.839555 8 to 31 15.83 19.7553 0.286935 9 to 32 15.75 19.3933 0.306432 degree of freedoms is: 17 --------------------------------------------------------------- p-value for KStest on those 9 p-values: 0.497800 |-------------------------------------------------------------| | THE OVERLAPPING 5-PERMUTATION TEST | |This is the OPERM5 test. It looks at a sequence of one mill-| |ion 32-bit random integers. Each set of five consecutive | |integers can be in one of 120 states, for the 5! possible or-| |derings of five numbers. Thus the 5th, 6th, 7th,...numbers | |each provide a state. As many thousands of state transitions | |are observed, cumulative counts are made of the number of | |occurences of each state. Then the quadratic form in the | |weak inverse of the 120x120 covariance matrix yields a test | |equivalent to the likelihood ratio test that the 120 cell | |counts came from the specified (asymptotically) normal dis- | |tribution with the specified 120x120 covariance matrix (with | |rank 99). This version uses 1,000,000 integers, twice. | |-------------------------------------------------------------| OPERM5 test for file (For samples of 1,000,000 consecutive 5-tuples) sample 1 chisquare=133.019317 with df=99; p-value= 0.012812 _______________________________________________________________ sample 2 chisquare=80.352949 with df=99; p-value= 0.914772 _______________________________________________________________ |-------------------------------------------------------------| |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. | |-------------------------------------------------------------| Rank test for binary matrices (31x31) from dump3 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=28 214 211.4 0.032 0.032 r=29 5099 5134.0 0.239 0.270 r=30 23095 23103.0 0.003 0.273 r=31 11592 11551.5 0.142 0.415 chi-square = 0.415 with df = 3; p-value = 0.937 -------------------------------------------------------------- |-------------------------------------------------------------| |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) from dump3 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=29 182 211.4 4.093 4.093 r=30 5041 5134.0 1.685 5.778 r=31 23294 23103.0 1.578 7.357 r=32 11483 11551.5 0.406 7.763 chi-square = 7.763 with df = 3; p-value = 0.051 -------------------------------------------------------------- |-------------------------------------------------------------| |This is the BINARY RANK TEST for 6x8 matrices. From each of | |six random 32-bit integers from the generator under test, a | |specified byte is chosen, and the resulting six bytes form a | |6x8 binary matrix whose rank is determined. That rank can be| |from 0 to 6, but ranks 0,1,2,3 are rare; their counts are | |pooled with those for rank 4. Ranks are found for 100,000 | |random matrices, and a chi-square test is performed on | |counts for ranks 6,5 and (0,...,4) (pooled together). | |-------------------------------------------------------------| Rank test for binary matrices (6x8) from dump3 bits 1 to 8 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1007 944.3 4.163 4.163 r=5 21840 21743.9 0.425 4.588 r=6 77153 77311.8 0.326 4.914 chi-square = 4.914 with df = 2; p-value = 0.086 -------------------------------------------------------------- bits 2 to 9 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 940 944.3 0.020 0.020 r=5 21687 21743.9 0.149 0.168 r=6 77373 77311.8 0.048 0.217 chi-square = 0.217 with df = 2; p-value = 0.897 -------------------------------------------------------------- bits 3 to 10 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 911 944.3 1.174 1.174 r=5 21767 21743.9 0.025 1.199 r=6 77322 77311.8 0.001 1.200 chi-square = 1.200 with df = 2; p-value = 0.549 -------------------------------------------------------------- bits 4 to 11 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 987 944.3 1.931 1.931 r=5 21666 21743.9 0.279 2.210 r=6 77347 77311.8 0.016 2.226 chi-square = 2.226 with df = 2; p-value = 0.329 -------------------------------------------------------------- bits 5 to 12 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 967 944.3 0.546 0.546 r=5 21604 21743.9 0.900 1.446 r=6 77429 77311.8 0.178 1.623 chi-square = 1.623 with df = 2; p-value = 0.444 -------------------------------------------------------------- bits 6 to 13 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 930 944.3 0.217 0.217 r=5 21764 21743.9 0.019 0.235 r=6 77306 77311.8 0.000 0.236 chi-square = 0.236 with df = 2; p-value = 0.889 -------------------------------------------------------------- bits 7 to 14 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 947 944.3 0.008 0.008 r=5 21707 21743.9 0.063 0.070 r=6 77346 77311.8 0.015 0.085 chi-square = 0.085 with df = 2; p-value = 0.958 -------------------------------------------------------------- bits 8 to 15 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 999 944.3 3.169 3.169 r=5 21782 21743.9 0.067 3.235 r=6 77219 77311.8 0.111 3.347 chi-square = 3.347 with df = 2; p-value = 0.188 -------------------------------------------------------------- bits 9 to 16 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 968 944.3 0.595 0.595 r=5 21617 21743.9 0.741 1.335 r=6 77415 77311.8 0.138 1.473 chi-square = 1.473 with df = 2; p-value = 0.479 -------------------------------------------------------------- bits 10 to 17 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 960 944.3 0.261 0.261 r=5 21739 21743.9 0.001 0.262 r=6 77301 77311.8 0.002 0.264 chi-square = 0.264 with df = 2; p-value = 0.876 -------------------------------------------------------------- bits 11 to 18 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 949 944.3 0.023 0.023 r=5 21780 21743.9 0.060 0.083 r=6 77271 77311.8 0.022 0.105 chi-square = 0.105 with df = 2; p-value = 0.949 -------------------------------------------------------------- bits 12 to 19 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 921 944.3 0.575 0.575 r=5 21673 21743.9 0.231 0.806 r=6 77406 77311.8 0.115 0.921 chi-square = 0.921 with df = 2; p-value = 0.631 -------------------------------------------------------------- bits 13 to 20 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 935 944.3 0.092 0.092 r=5 21647 21743.9 0.432 0.523 r=6 77418 77311.8 0.146 0.669 chi-square = 0.669 with df = 2; p-value = 0.716 -------------------------------------------------------------- bits 14 to 21 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 912 944.3 1.105 1.105 r=5 21785 21743.9 0.078 1.183 r=6 77303 77311.8 0.001 1.184 chi-square = 1.184 with df = 2; p-value = 0.553 -------------------------------------------------------------- bits 15 to 22 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 893 944.3 2.787 2.787 r=5 21945 21743.9 1.860 4.647 r=6 77162 77311.8 0.290 4.937 chi-square = 4.937 with df = 2; p-value = 0.085 -------------------------------------------------------------- bits 16 to 23 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 948 944.3 0.014 0.014 r=5 21894 21743.9 1.036 1.051 r=6 77158 77311.8 0.306 1.357 chi-square = 1.357 with df = 2; p-value = 0.507 -------------------------------------------------------------- bits 17 to 24 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 981 944.3 1.426 1.426 r=5 21833 21743.9 0.365 1.791 r=6 77186 77311.8 0.205 1.996 chi-square = 1.996 with df = 2; p-value = 0.369 -------------------------------------------------------------- bits 18 to 25 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 913 944.3 1.037 1.037 r=5 21799 21743.9 0.140 1.177 r=6 77288 77311.8 0.007 1.184 chi-square = 1.184 with df = 2; p-value = 0.553 -------------------------------------------------------------- bits 19 to 26 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 887 944.3 3.477 3.477 r=5 21779 21743.9 0.057 3.534 r=6 77334 77311.8 0.006 3.540 chi-square = 3.540 with df = 2; p-value = 0.170 -------------------------------------------------------------- bits 20 to 27 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 964 944.3 0.411 0.411 r=5 21667 21743.9 0.272 0.683 r=6 77369 77311.8 0.042 0.725 chi-square = 0.725 with df = 2; p-value = 0.696 -------------------------------------------------------------- bits 21 to 28 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 984 944.3 1.669 1.669 r=5 21681 21743.9 0.182 1.851 r=6 77335 77311.8 0.007 1.858 chi-square = 1.858 with df = 2; p-value = 0.395 -------------------------------------------------------------- bits 22 to 29 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 969 944.3 0.646 0.646 r=5 21737 21743.9 0.002 0.648 r=6 77294 77311.8 0.004 0.652 chi-square = 0.652 with df = 2; p-value = 0.722 -------------------------------------------------------------- bits 23 to 30 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 951 944.3 0.048 0.048 r=5 21742 21743.9 0.000 0.048 r=6 77307 77311.8 0.000 0.048 chi-square = 0.048 with df = 2; p-value = 0.976 -------------------------------------------------------------- bits 24 to 31 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 920 944.3 0.625 0.625 r=5 21849 21743.9 0.508 1.133 r=6 77231 77311.8 0.084 1.218 chi-square = 1.218 with df = 2; p-value = 0.544 -------------------------------------------------------------- bits 25 to 32 RANK OBSERVED EXPECTED (O-E)^2/E SUM r<=4 922 944.3 0.527 0.527 r=5 21666 21743.9 0.279 0.806 r=6 77412 77311.8 0.130 0.936 chi-square = 0.936 with df = 2; p-value = 0.626 -------------------------------------------------------------- TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices These should be 25 uniform [0,1] random variates: 0.085688 0.897213 0.548761 0.328580 0.444087 0.888888 0.958166 0.187615 0.478743 0.876498 0.948921 0.631008 0.715588 0.553353 0.084709 0.507476 0.368590 0.553101 0.170334 0.695841 0.394954 0.721674 0.976285 0.543957 0.626387 The KS test for those 25 supposed UNI's yields KS p-value = 0.356077 |-------------------------------------------------------------| | 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 dump3 (20 bits/word, 2097152 words 20 bitstreams. No. missing words should average 141909.33 with sigma=428.00.) ---------------------------------------------------------------- BITSTREAM test results for dump3. Bitstream No. missing words z-score p-value 1 141954 0.10 0.458438 2 141343 -1.32 0.907116 3 142148 0.56 0.288545 4 141473 -1.02 0.846008 5 141970 0.14 0.443638 6 142511 1.41 0.079896 7 142343 1.01 0.155471 8 141933 0.06 0.477948 9 141612 -0.69 0.756377 10 141737 -0.40 0.656393 11 142626 1.67 0.047020 12 141641 -0.63 0.734650 13 141815 -0.22 0.587219 14 142670 1.78 0.037762 15 141123 -1.84 0.966911 16 141179 -1.71 0.956031 17 141263 -1.51 0.934493 18 142604 1.62 0.052288 19 140946 -2.25 0.987800 20 142039 0.30 0.380957 ---------------------------------------------------------------- |-------------------------------------------------------------| | 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 file dump3 Bits used No. missing words z-score p-value 23 to 32 141630 -0.9632 0.832278 22 to 31 141858 -0.1770 0.570246 21 to 30 142277 1.2678 0.102430 20 to 29 141528 -1.3149 0.905733 19 to 28 141605 -1.0494 0.853006 18 to 27 141698 -0.7287 0.766915 17 to 26 141578 -1.1425 0.873380 16 to 25 142574 2.2920 0.010954 15 to 24 142189 0.9644 0.167428 14 to 23 141530 -1.3080 0.904569 13 to 22 142019 0.3782 0.352651 12 to 21 141970 0.2092 0.417143 11 to 20 141922 0.0437 0.482576 10 to 19 142104 0.6713 0.251022 9 to 18 141501 -1.4080 0.920440 8 to 17 142198 0.9954 0.159767 7 to 16 141916 0.0230 0.490825 6 to 15 142075 0.5713 0.283906 5 to 14 141460 -1.5494 0.939359 4 to 13 141450 -1.5839 0.943391 3 to 12 141961 0.1782 0.429294 2 to 11 141966 0.1954 0.422534 1 to 10 141732 -0.6115 0.729560 ----------------------------------------------------------------- |------------------------------------------------------------ | | 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 file dump3 Bits used No. missing words z-score p-value 28 to 32 141728 -0.6147 0.730616 27 to 31 141948 0.1311 0.447854 26 to 30 141819 -0.3062 0.620275 25 to 29 141915 0.0192 0.492333 24 to 28 142119 0.7107 0.238621 23 to 27 141796 -0.3842 0.649574 22 to 26 141580 -1.1164 0.867869 21 to 25 142018 0.3684 0.356298 20 to 24 141998 0.3006 0.381869 19 to 23 141835 -0.2520 0.599466 18 to 22 141505 -1.3706 0.914752 17 to 21 141953 0.1480 0.441158 16 to 20 141385 -1.7774 0.962248 15 to 19 142046 0.4633 0.321579 14 to 18 142025 0.3921 0.347491 13 to 17 142514 2.0497 0.020195 12 to 16 142014 0.3548 0.361365 11 to 15 142854 3.2023 0.000682 10 to 14 142100 0.6463 0.259030 9 to 13 141644 -0.8994 0.815786 8 to 12 142430 1.7650 0.038783 7 to 11 141607 -1.0248 0.847282 6 to 10 141976 0.2260 0.410601 5 to 9 141687 -0.7537 0.774474 4 to 8 142250 1.1548 0.124083 3 to 7 141575 -1.1333 0.871460 2 to 6 142430 1.7650 0.038783 1 to 5 142066 0.5311 0.297680 ----------------------------------------------------------------- |------------------------------------------------------------ | | 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 file dump3 Bits used No. missing words z-score p-value 31 to 32 142097 0.5536 0.289927 30 to 31 142086 0.5212 0.301131 29 to 30 141704 -0.6057 0.727641 28 to 29 141466 -1.3078 0.904522 27 to 28 141629 -0.8269 0.795862 26 to 27 142230 0.9459 0.172092 25 to 26 142109 0.5890 0.277932 24 to 25 141419 -1.4464 0.925968 23 to 24 141921 0.0344 0.486269 22 to 23 141419 -1.4464 0.925968 21 to 22 141704 -0.6057 0.727641 20 to 21 142274 1.0757 0.141026 19 to 20 141735 -0.5142 0.696461 18 to 19 142183 0.8073 0.209751 17 to 18 142075 0.4887 0.312526 16 to 17 141967 0.1701 0.432459 15 to 16 142015 0.3117 0.377630 14 to 15 141874 -0.1042 0.541502 13 to 14 142173 0.7778 0.218347 12 to 13 142024 0.3383 0.367584 11 to 12 141578 -0.9774 0.835808 10 to 11 141678 -0.6824 0.752504 9 to 10 141355 -1.6352 0.948996 8 to 9 141769 -0.4140 0.660546 7 to 8 142311 1.1849 0.118035 6 to 7 142035 0.3707 0.355427 5 to 6 142314 1.1937 0.116294 4 to 5 141809 -0.2960 0.616369 3 to 4 141721 -0.5555 0.710739 2 to 3 142136 0.6686 0.251862 1 to 2 141974 0.1908 0.424354 ----------------------------------------------------------------- |-------------------------------------------------------------| | 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 for the byte stream from dump3 (Degrees of freedom: 5^4-5^3=2500; sample size: 2560000) chisquare z-score p-value 2549.58 0.701 0.241581 |-------------------------------------------------------------| | 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 from dump3 (Degrees of freedom: 5^4-5^3=2500; sample size: 256000) bits used chisquare z-score p-value 1 to 8 2428.76 -1.007 0.843135 2 to 9 2447.30 -0.745 0.771936 3 to 10 2541.29 0.584 0.279634 4 to 11 2496.76 -0.046 0.518265 5 to 12 2622.34 1.730 0.041807 6 to 13 2473.13 -0.380 0.648008 7 to 14 2476.71 -0.329 0.629054 8 to 15 2574.48 1.053 0.146101 9 to 16 2622.73 1.736 0.041312 10 to 17 2548.30 0.683 0.247271 11 to 18 2424.42 -1.069 0.857426 12 to 19 2512.33 0.174 0.430790 13 to 20 2533.70 0.477 0.316824 14 to 21 2416.13 -1.186 0.882205 15 to 22 2603.93 1.470 0.070802 16 to 23 2508.17 0.115 0.454029 17 to 24 2518.23 0.258 0.398281 18 to 25 2405.19 -1.341 0.910013 19 to 26 2549.39 0.699 0.242423 20 to 27 2509.79 0.138 0.444930 21 to 28 2557.98 0.820 0.206107 22 to 29 2510.63 0.150 0.440265 23 to 30 2559.43 0.841 0.200305 24 to 31 2492.19 -0.110 0.543976 25 to 32 2581.26 1.149 0.125229 |-------------------------------------------------------------| | THIS IS A PARKING LOT TEST | |In a square of side 100, randomly "park" a car---a circle of | |radius 1. Then try to park a 2nd, a 3rd, and so on, each | |time parking "by ear". That is, if an attempt to park a car | |causes a crash with one already parked, try again at a new | |random location. (To avoid path problems, consider parking | |helicopters rather than cars.) Each attempt leads to either| |a crash or a success, the latter followed by an increment to | |the list of cars already parked. If we plot n: the number of | |attempts, versus k: the number successfully parked, we get a | |curve that should be similar to those provided by a perfect | |random number generator. Theory for the behavior of such a | |random curve seems beyond reach, and as graphics displays are| |not available for this battery of tests, a simple characteriz| |ation of the random experiment is used: k, the number of cars| |successfully parked after n=12,000 attempts. Simulation shows| |that k should average 3523 with sigma 21.9 and is very close | |to normally distributed. Thus (k-3523)/21.9 should be a st- | |andard normal variable, which, converted to a uniform varia- | |ble, provides input to a KSTEST based on a sample of 10. | |-------------------------------------------------------------| CDPARK: result of 10 tests on file dump3 (Of 12000 tries, the average no. of successes should be 3523.0 with sigma=21.9) No. succeses z-score p-value 3545 1.0046 0.157553 3495 -1.2785 0.899470 3523 0.0000 0.500000 3517 -0.2740 0.607947 3520 -0.1370 0.554479 3529 0.2740 0.392053 3525 0.0913 0.463617 3574 2.3288 0.009936 3510 -0.5936 0.723613 3524 0.0457 0.481790 Square side=100, avg. no. parked=3526.20 sample std.=20.05 p-value of the KSTEST for those 10 p-values: 0.002815 |-------------------------------------------------------------| | THE MINIMUM DISTANCE TEST | |It does this 100 times: choose n=8000 random points in a | |square of side 10000. Find d, the minimum distance between | |the (n^2-n)/2 pairs of points. If the points are truly inde-| |pendent uniform, then d^2, the square of the minimum distance| |should be (very close to) exponentially distributed with mean| |.995 . Thus 1-exp(-d^2/.995) should be uniform on [0,1) and | |a KSTEST on the resulting 100 values serves as a test of uni-| |formity for random points in the square. Test numbers=0 mod 5| |are printed but the KSTEST is based on the full set of 100 | |random choices of 8000 points in the 10000x10000 square. | |-------------------------------------------------------------| This is the MINIMUM DISTANCE test for file dump3 Sample no. d^2 mean equiv uni 5 0.3536 0.6312 0.299101 10 0.1923 0.7968 0.175697 15 0.6019 0.7082 0.453879 20 1.3452 0.7656 0.741273 25 0.7816 0.8250 0.544122 30 0.1056 0.9246 0.100718 35 0.1419 0.8664 0.132934 40 0.0138 0.8293 0.013761 45 0.8878 0.8463 0.590257 50 0.3162 0.8228 0.272214 55 1.0662 0.8177 0.657525 60 1.0188 0.7928 0.640801 65 0.8614 0.8754 0.579246 70 1.4241 0.8909 0.760985 75 0.5804 0.8703 0.441934 80 0.9643 0.9308 0.620602 85 0.2411 0.8891 0.215200 90 1.1034 0.9251 0.670101 95 2.1183 0.9408 0.881038 100 0.8207 0.9651 0.561669 -------------------------------------------------------------- Result of KS test on 100 transformed mindist^2's: p-value=0.116604 |-------------------------------------------------------------| | THE 3DSPHERES TEST | |Choose 4000 random points in a cube of edge 1000. At each | |point, center a sphere large enough to reach the next closest| |point. Then the volume of the smallest such sphere is (very | |close to) exponentially distributed with mean 120pi/3. Thus | |the radius cubed is exponential with mean 30. (The mean is | |obtained by extensive simulation). The 3DSPHERES test gener-| |ates 4000 such spheres 20 times. Each min radius cubed leads| |to a uniform variable by means of 1-exp(-r^3/30.), then a | | KSTEST is done on the 20 p-values. | |-------------------------------------------------------------| The 3DSPHERES test for file dump3 sample no r^3 equiv. uni. 1 35.810 0.696897 2 0.436 0.014431 3 68.151 0.896864 4 175.209 0.997092 5 0.942 0.030911 6 5.063 0.155299 7 21.647 0.514016 8 45.537 0.780827 9 4.417 0.136916 10 5.690 0.172774 11 7.288 0.215667 12 24.425 0.556985 13 72.472 0.910697 14 6.174 0.186014 15 28.891 0.618263 16 17.705 0.445759 17 14.290 0.378951 18 1.801 0.058261 19 22.718 0.531056 20 21.172 0.506260 -------------------------------------------------------------- p-value for KS test on those 20 p-values: 0.483178 |-------------------------------------------------------------| | 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 dump3 Table of standardized frequency counts (obs-exp)^2/exp for j=(1,..,6), 7,...,47,(48,...) -0.8 -1.6 -0.1 -0.1 1.9 -1.7 -0.1 1.1 0.0 -0.5 0.9 -0.5 0.6 -1.0 0.7 -0.2 0.0 0.2 0.1 0.6 1.2 -1.1 -0.3 -0.6 -0.6 0.1 -0.0 -1.5 1.0 -2.4 -0.1 0.7 0.9 0.7 0.1 0.2 2.4 -0.7 0.5 -0.1 1.6 0.0 0.8 Chi-square with 42 degrees of freedom:38.668151 z-score=-0.363534, p-value=0.618029 _____________________________________________________________ |-------------------------------------------------------------| | 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 dump3 Test no p-value 1 0.156333 2 0.902650 3 0.010620 4 0.164936 5 0.684545 6 0.631314 7 0.040127 8 0.297824 9 0.065989 10 0.342523 _____________________________________________________________ p-value for 10 kstests on 100 kstests:0.066839 |-------------------------------------------------------------| | This is the RUNS test. It counts runs up, and runs down,| |in a sequence of uniform [0,1) variables, obtained by float- | |ing the 32-bit integers in the specified file. This example | |shows how runs are counted: .123,.357,.789,.425,.224,.416,.95| |contains an up-run of length 3, a down-run of length 2 and an| |up-run of (at least) 2, depending on the next values. The | |covariance matrices for the runs-up and runs-down are well | |known, leading to chisquare tests for quadratic forms in the | |weak inverses of the covariance matrices. Runs are counted | |for sequences of length 10,000. This is done ten times. Then| |another three sets of ten. | |-------------------------------------------------------------| The RUNS test for file dump3 (Up and down runs in a sequence of 10000 numbers) Set 1 runs up; ks test for 10 p's: 0.179770 runs down; ks test for 10 p's: 0.115654 Set 2 runs up; ks test for 10 p's: 0.023638 runs down; ks test for 10 p's: 0.269618 |-------------------------------------------------------------| |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 dump3 No. of wins: Observed Expected 98960 98585.858586 z-score= 1.673, pvalue=0.04713 Analysis of Throws-per-Game: Throws Observed Expected Chisq Sum of (O-E)^2/E 1 66673 66666.7 0.001 0.001 2 37764 37654.3 0.319 0.320 3 27075 26954.7 0.537 0.857 4 19449 19313.5 0.951 1.808 5 13759 13851.4 0.617 2.425 6 9774 9943.5 2.891 5.315 7 7097 7145.0 0.323 5.638 8 5196 5139.1 0.631 6.269 9 3653 3699.9 0.594 6.862 10 2711 2666.3 0.749 7.612 11 1931 1923.3 0.031 7.642 12 1350 1388.7 1.081 8.723 13 987 1003.7 0.278 9.001 14 720 726.1 0.052 9.053 15 510 525.8 0.477 9.530 16 354 381.2 1.934 11.464 17 262 276.5 0.764 12.229 18 182 200.8 1.765 13.994 19 160 146.0 1.346 15.340 20 118 106.2 1.308 16.647 21 275 287.1 0.511 17.159 Chisq= 17.16 for 20 degrees of freedom, p= 0.64266 SUMMARY of craptest on dump3 p-value for no. of wins: 0.047126 p-value for throws/game: 0.642655 _____________________________________________________________