Below is the output of the 'diehard' Random Number Generator suite (see http://stat.fsu.edu/~geo/diehard.html) on the file "testRng.out" as generated by testRng. The output shows that libecc::rng passes all tests. ========================================================================== NOTE: Most of the tests in DIEHARD return a p-value, which should be uniform on [0,1) if the input file contains truly independent random bits. Those p-values are obtained by p=F(X), where F is the assumed distribution of the sample random variable X---often normal. But that assumed F is just an asymptotic approximation, for which the fit will be worst in the tails. Thus you should not be surprised with occasional p-values near 0 or 1, such as .0012 or .9983. When a bit stream really FAILS BIG, you will get p's of 0 or 1 to six or more places. By all means, do not, as a Statistician might, think that a p < .025 or p> .975 means that the RNG has "failed the test at the .05 level". Such p's happen among the hundreds that DIEHARD produces, even with good RNG's. So keep in mind that " p happens". ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the BIRTHDAY SPACINGS TEST :: :: Choose m birthdays in a year of n days. List the spacings :: :: between the birthdays. If j is the number of values that :: :: occur more than once in that list, then j is asymptotically :: :: Poisson distributed with mean m^3/(4n). Experience shows n :: :: must be quite large, say n>=2^18, for comparing the results :: :: to the Poisson distribution with that mean. This test uses :: :: n=2^24 and m=2^9, so that the underlying distribution for j :: :: is taken to be Poisson with lambda=2^27/(2^26)=2. A sample :: :: of 500 j's is taken, and a chi-square goodness of fit test :: :: provides a p value. The first test uses bits 1-24 (counting :: :: from the left) from integers in the specified file. :: :: Then the file is closed and reopened. Next, bits 2-25 are :: :: used to provide birthdays, then 3-26 and so on to bits 9-32. :: :: Each set of bits provides a p-value, and the nine p-values :: :: provide a sample for a KSTEST. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: BIRTHDAY SPACINGS TEST, M= 512 N=2**24 LAMBDA= 2.0000 Results for testRng.out For a sample of size 500: mean testRng.out using bits 1 to 24 1.964 duplicate number number spacings observed expected 0 63. 67.668 1 137. 135.335 2 146. 135.335 3 91. 90.224 4 40. 45.112 5 19. 18.045 6 to INF 4. 8.282 Chisquare with 6 d.o.f. = 4.03 p-value= .327802 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean testRng.out using bits 2 to 25 2.006 duplicate number number spacings observed expected 0 63. 67.668 1 147. 135.335 2 123. 135.335 3 94. 90.224 4 48. 45.112 5 18. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 2.99 p-value= .190296 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean testRng.out using bits 3 to 26 2.040 duplicate number number spacings observed expected 0 64. 67.668 1 126. 135.335 2 148. 135.335 3 86. 90.224 4 49. 45.112 5 19. 18.045 6 to INF 8. 8.282 Chisquare with 6 d.o.f. = 2.62 p-value= .145301 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean testRng.out using bits 4 to 27 1.892 duplicate number number spacings observed expected 0 67. 67.668 1 165. 135.335 2 123. 135.335 3 82. 90.224 4 41. 45.112 5 11. 18.045 6 to INF 11. 8.282 Chisquare with 6 d.o.f. = 12.40 p-value= .946382 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean testRng.out using bits 5 to 28 1.974 duplicate number number spacings observed expected 0 85. 67.668 1 133. 135.335 2 114. 135.335 3 88. 90.224 4 53. 45.112 5 18. 18.045 6 to INF 9. 8.282 Chisquare with 6 d.o.f. = 9.34 p-value= .844649 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean testRng.out using bits 6 to 29 2.052 duplicate number number spacings observed expected 0 61. 67.668 1 135. 135.335 2 131. 135.335 3 99. 90.224 4 53. 45.112 5 12. 18.045 6 to INF 9. 8.282 Chisquare with 6 d.o.f. = 5.12 p-value= .471095 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean testRng.out using bits 7 to 30 2.112 duplicate number number spacings observed expected 0 60. 67.668 1 137. 135.335 2 126. 135.335 3 91. 90.224 4 51. 45.112 5 22. 18.045 6 to INF 13. 8.282 Chisquare with 6 d.o.f. = 5.86 p-value= .561343 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean testRng.out using bits 8 to 31 2.074 duplicate number number spacings observed expected 0 65. 67.668 1 129. 135.335 2 134. 135.335 3 98. 90.224 4 40. 45.112 5 23. 18.045 6 to INF 11. 8.282 Chisquare with 6 d.o.f. = 3.92 p-value= .312137 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean testRng.out using bits 9 to 32 2.090 duplicate number number spacings observed expected 0 66. 67.668 1 124. 135.335 2 130. 135.335 3 105. 90.224 4 45. 45.112 5 20. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = 4.19 p-value= .348950 ::::::::::::::::::::::::::::::::::::::::: The 9 p-values were .327802 .190296 .145301 .946382 .844649 .471095 .561343 .312137 .348950 A KSTEST for the 9 p-values yields .229167 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 testRng.out For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom= 86.458; p-value= .188218 OPERM5 test for file testRng.out For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom= 85.253; p-value= .163883 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the BINARY RANK TEST for 31x31 matrices. The leftmost :: :: 31 bits of 31 random integers from the test sequence are used :: :: to form a 31x31 binary matrix over the field {0,1}. The rank :: :: is determined. That rank can be from 0 to 31, but ranks< 28 :: :: are rare, and their counts are pooled with those for rank 28. :: :: Ranks are found for 40,000 such random matrices and a chisqua-:: :: re test is performed on counts for ranks 31,30,29 and <=28. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Binary rank test for testRng.out Rank test for 31x31 binary matrices: rows from leftmost 31 bits of each 32-bit integer rank observed expected (o-e)^2/e sum 28 239 211.4 3.598397 3.598 29 5188 5134.0 .567761 4.166 30 22982 23103.0 .634217 4.800 31 11591 11551.5 .134902 4.935 chisquare= 4.935 for 3 d. of f.; p-value= .836559 -------------------------------------------------------------- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the BINARY RANK TEST for 32x32 matrices. A random 32x :: :: 32 binary matrix is formed, each row a 32-bit random integer. :: :: The rank is determined. That rank can be from 0 to 32, ranks :: :: less than 29 are rare, and their counts are pooled with those :: :: for rank 29. Ranks are found for 40,000 such random matrices :: :: and a chisquare test is performed on counts for ranks 32,31, :: :: 30 and <=29. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Binary rank test for testRng.out Rank test for 32x32 binary matrices: rows from leftmost 32 bits of each 32-bit integer rank observed expected (o-e)^2/e sum 29 224 211.4 .748784 .749 30 5130 5134.0 .003132 .752 31 23141 23103.0 .062348 .814 32 11505 11551.5 .187380 1.002 chisquare= 1.002 for 3 d. of f.; p-value= .357603 -------------------------------------------------------------- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the BINARY RANK TEST for 6x8 matrices. From each of :: :: six random 32-bit integers from the generator under test, a :: :: specified byte is chosen, and the resulting six bytes form a :: :: 6x8 binary matrix whose rank is determined. That rank can be :: :: from 0 to 6, but ranks 0,1,2,3 are rare; their counts are :: :: pooled with those for rank 4. Ranks are found for 100,000 :: :: random matrices, and a chi-square test is performed on :: :: counts for ranks 6,5 and <=4. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Binary Rank Test for testRng.out Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 1 to 8 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 975 944.3 .998 .998 r =5 21743 21743.9 .000 .998 r =6 77282 77311.8 .011 1.010 p=1-exp(-SUM/2)= .39635 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 2 to 9 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 951 944.3 .048 .048 r =5 21854 21743.9 .557 .605 r =6 77195 77311.8 .176 .781 p=1-exp(-SUM/2)= .32344 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 3 to 10 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 954 944.3 .100 .100 r =5 21607 21743.9 .862 .962 r =6 77439 77311.8 .209 1.171 p=1-exp(-SUM/2)= .44312 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 4 to 11 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 901 944.3 1.986 1.986 r =5 21584 21743.9 1.176 3.161 r =6 77515 77311.8 .534 3.696 p=1-exp(-SUM/2)= .84241 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 5 to 12 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1043 944.3 10.316 10.316 r =5 21712 21743.9 .047 10.363 r =6 77245 77311.8 .058 10.421 p=1-exp(-SUM/2)= .99454 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 6 to 13 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 981 944.3 1.426 1.426 r =5 21823 21743.9 .288 1.714 r =6 77196 77311.8 .173 1.887 p=1-exp(-SUM/2)= .61082 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 7 to 14 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 986 944.3 1.841 1.841 r =5 21539 21743.9 1.931 3.772 r =6 77475 77311.8 .344 4.117 p=1-exp(-SUM/2)= .87233 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 8 to 15 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 936 944.3 .073 .073 r =5 21509 21743.9 2.538 2.611 r =6 77555 77311.8 .765 3.376 p=1-exp(-SUM/2)= .81508 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 9 to 16 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 971 944.3 .755 .755 r =5 21905 21743.9 1.194 1.948 r =6 77124 77311.8 .456 2.405 p=1-exp(-SUM/2)= .69951 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 10 to 17 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 973 944.3 .872 .872 r =5 21885 21743.9 .916 1.788 r =6 77142 77311.8 .373 2.161 p=1-exp(-SUM/2)= .66053 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 11 to 18 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 984 944.3 1.669 1.669 r =5 21639 21743.9 .506 2.175 r =6 77377 77311.8 .055 2.230 p=1-exp(-SUM/2)= .67209 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 12 to 19 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 971 944.3 .755 .755 r =5 21770 21743.9 .031 .786 r =6 77259 77311.8 .036 .822 p=1-exp(-SUM/2)= .33710 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 13 to 20 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 956 944.3 .145 .145 r =5 21712 21743.9 .047 .192 r =6 77332 77311.8 .005 .197 p=1-exp(-SUM/2)= .09381 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 14 to 21 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1009 944.3 4.433 4.433 r =5 21645 21743.9 .450 4.883 r =6 77346 77311.8 .015 4.898 p=1-exp(-SUM/2)= .91361 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 15 to 22 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 919 944.3 .678 .678 r =5 21930 21743.9 1.593 2.271 r =6 77151 77311.8 .334 2.605 p=1-exp(-SUM/2)= .72817 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 16 to 23 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 987 944.3 1.931 1.931 r =5 21754 21743.9 .005 1.935 r =6 77259 77311.8 .036 1.971 p=1-exp(-SUM/2)= .62684 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 17 to 24 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 969 944.3 .646 .646 r =5 21654 21743.9 .372 1.018 r =6 77377 77311.8 .055 1.073 p=1-exp(-SUM/2)= .41512 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 18 to 25 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 945 944.3 .001 .001 r =5 21736 21743.9 .003 .003 r =6 77319 77311.8 .001 .004 p=1-exp(-SUM/2)= .00203 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 19 to 26 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 946 944.3 .003 .003 r =5 21761 21743.9 .013 .017 r =6 77293 77311.8 .005 .021 p=1-exp(-SUM/2)= .01048 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 20 to 27 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1013 944.3 4.998 4.998 r =5 21861 21743.9 .631 5.629 r =6 77126 77311.8 .447 6.075 p=1-exp(-SUM/2)= .95205 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 21 to 28 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 983 944.3 1.586 1.586 r =5 21736 21743.9 .003 1.589 r =6 77281 77311.8 .012 1.601 p=1-exp(-SUM/2)= .55091 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 22 to 29 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 935 944.3 .092 .092 r =5 21883 21743.9 .890 .981 r =6 77182 77311.8 .218 1.199 p=1-exp(-SUM/2)= .45102 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 23 to 30 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1030 944.3 7.777 7.777 r =5 21861 21743.9 .631 8.408 r =6 77109 77311.8 .532 8.940 p=1-exp(-SUM/2)= .98855 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 24 to 31 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 947 944.3 .008 .008 r =5 21873 21743.9 .767 .774 r =6 77180 77311.8 .225 .999 p=1-exp(-SUM/2)= .39314 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG testRng.out b-rank test for bits 25 to 32 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 882 944.3 4.110 4.110 r =5 21591 21743.9 1.075 5.186 r =6 77527 77311.8 .599 5.785 p=1-exp(-SUM/2)= .94455 TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices These should be 25 uniform [0,1] random variables: .396352 .323443 .443119 .842410 .994540 .610824 .872334 .815076 .699507 .660535 .672085 .337100 .093808 .913611 .728169 .626837 .415115 .002027 .010483 .952047 .550911 .451024 .988553 .393142 .944550 brank test summary for testRng.out The KS test for those 25 supposed UNI's yields KS p-value= .880596 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: THE BITSTREAM TEST :: :: The file under test is viewed as a stream of bits. Call them :: :: b1,b2,... . Consider an alphabet with two "letters", 0 and 1 :: :: and think of the stream of bits as a succession of 20-letter :: :: "words", overlapping. Thus the first word is b1b2...b20, the :: :: second is b2b3...b21, and so on. The bitstream test counts :: :: the number of missing 20-letter (20-bit) words in a string of :: :: 2^21 overlapping 20-letter words. There are 2^20 possible 20 :: :: letter words. For a truly random string of 2^21+19 bits, the :: :: number of missing words j should be (very close to) normally :: :: distributed with mean 141,909 and sigma 428. Thus :: :: (j-141909)/428 should be a standard normal variate (z score) :: :: that leads to a uniform [0,1) p value. The test is repeated :: :: twenty times. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: THE OVERLAPPING 20-tuples BITSTREAM TEST, 20 BITS PER WORD, 2^21 words. This test samples the bitstream 20 times. No. missing words should average 141909. with sigma=428. ----------------------------------- --------------- tst no 1: 141616 missing words, -.69 sigmas from mean, p-value= .24656 tst no 2: 142675 missing words, 1.79 sigmas from mean, p-value= .96319 tst no 3: 142207 missing words, .70 sigmas from mean, p-value= .75663 tst no 4: 141985 missing words, .18 sigmas from mean, p-value= .57017 tst no 5: 142006 missing words, .23 sigmas from mean, p-value= .58935 tst no 6: 141234 missing words, -1.58 sigmas from mean, p-value= .05730 tst no 7: 141940 missing words, .07 sigmas from mean, p-value= .52857 tst no 8: 141921 missing words, .03 sigmas from mean, p-value= .51088 tst no 9: 141776 missing words, -.31 sigmas from mean, p-value= .37770 tst no 10: 142123 missing words, .50 sigmas from mean, p-value= .69119 tst no 11: 142731 missing words, 1.92 sigmas from mean, p-value= .97256 tst no 12: 142451 missing words, 1.27 sigmas from mean, p-value= .89717 tst no 13: 141435 missing words, -1.11 sigmas from mean, p-value= .13388 tst no 14: 142032 missing words, .29 sigmas from mean, p-value= .61280 tst no 15: 142241 missing words, .77 sigmas from mean, p-value= .78081 tst no 16: 141604 missing words, -.71 sigmas from mean, p-value= .23780 tst no 17: 142637 missing words, 1.70 sigmas from mean, p-value= .95545 tst no 18: 141584 missing words, -.76 sigmas from mean, p-value= .22359 tst no 19: 141290 missing words, -1.45 sigmas from mean, p-value= .07394 tst no 20: 141547 missing words, -.85 sigmas from mean, p-value= .19862 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: The tests OPSO, OQSO and DNA :: :: OPSO means Overlapping-Pairs-Sparse-Occupancy :: :: The OPSO test considers 2-letter words from an alphabet of :: :: 1024 letters. Each letter is determined by a specified ten :: :: bits from a 32-bit integer in the sequence to be tested. OPSO :: :: generates 2^21 (overlapping) 2-letter words (from 2^21+1 :: :: "keystrokes") and counts the number of missing words---that :: :: is 2-letter words which do not appear in the entire sequence. :: :: That count should be very close to normally distributed with :: :: mean 141,909, sigma 290. Thus (missingwrds-141909)/290 should :: :: be a standard normal variable. The OPSO test takes 32 bits at :: :: a time from the test file and uses a designated set of ten :: :: consecutive bits. It then restarts the file for the next de- :: :: signated 10 bits, and so on. :: :: :: :: OQSO means Overlapping-Quadruples-Sparse-Occupancy :: :: The test OQSO is similar, except that it considers 4-letter :: :: words from an alphabet of 32 letters, each letter determined :: :: by a designated string of 5 consecutive bits from the test :: :: file, elements of which are assumed 32-bit random integers. :: :: The mean number of missing words in a sequence of 2^21 four- :: :: letter words, (2^21+3 "keystrokes"), is again 141909, with :: :: sigma = 295. The mean is based on theory; sigma comes from :: :: extensive simulation. :: :: :: :: The DNA test considers an alphabet of 4 letters:: C,G,A,T,:: :: determined by two designated bits in the sequence of random :: :: integers being tested. It considers 10-letter words, so that :: :: as in OPSO and OQSO, there are 2^20 possible words, and the :: :: mean number of missing words from a string of 2^21 (over- :: :: lapping) 10-letter words (2^21+9 "keystrokes") is 141909. :: :: The standard deviation sigma=339 was determined as for OQSO :: :: by simulation. (Sigma for OPSO, 290, is the true value (to :: :: three places), not determined by simulation. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: OPSO test for generator testRng.out Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OPSO for testRng.out using bits 23 to 32 142090 .623 .7334 OPSO for testRng.out using bits 22 to 31 141651 -.891 .1865 OPSO for testRng.out using bits 21 to 30 142818 3.133 .9991 OPSO for testRng.out using bits 20 to 29 141717 -.663 .2536 OPSO for testRng.out using bits 19 to 28 141766 -.494 .3106 OPSO for testRng.out using bits 18 to 27 141751 -.546 .2925 OPSO for testRng.out using bits 17 to 26 141805 -.360 .3595 OPSO for testRng.out using bits 16 to 25 141921 .040 .5161 OPSO for testRng.out using bits 15 to 24 141806 -.356 .3608 OPSO for testRng.out using bits 14 to 23 141846 -.218 .4136 OPSO for testRng.out using bits 13 to 22 142166 .885 .8119 OPSO for testRng.out using bits 12 to 21 141955 .157 .5626 OPSO for testRng.out using bits 11 to 20 142020 .382 .6486 OPSO for testRng.out using bits 10 to 19 142322 1.423 .9226 OPSO for testRng.out using bits 9 to 18 142318 1.409 .9206 OPSO for testRng.out using bits 8 to 17 141954 .154 .5612 OPSO for testRng.out using bits 7 to 16 141878 -.108 .4570 OPSO for testRng.out using bits 6 to 15 141933 .082 .5325 OPSO for testRng.out using bits 5 to 14 141698 -.729 .2331 OPSO for testRng.out using bits 4 to 13 141704 -.708 .2395 OPSO for testRng.out using bits 3 to 12 141520 -1.343 .0897 OPSO for testRng.out using bits 2 to 11 142148 .823 .7947 OPSO for testRng.out using bits 1 to 10 142504 2.051 .9798 OQSO test for generator testRng.out Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OQSO for testRng.out using bits 28 to 32 141542 -1.245 .1065 OQSO for testRng.out using bits 27 to 31 141777 -.449 .3269 OQSO for testRng.out using bits 26 to 30 141432 -1.618 .0528 OQSO for testRng.out using bits 25 to 29 141404 -1.713 .0434 OQSO for testRng.out using bits 24 to 28 141908 -.005 .4982 OQSO for testRng.out using bits 23 to 27 142177 .907 .8179 OQSO for testRng.out using bits 22 to 26 141885 -.082 .4671 OQSO for testRng.out using bits 21 to 25 142126 .734 .7687 OQSO for testRng.out using bits 20 to 24 141802 -.364 .3580 OQSO for testRng.out using bits 19 to 23 141797 -.381 .3517 OQSO for testRng.out using bits 18 to 22 141841 -.232 .4084 OQSO for testRng.out using bits 17 to 21 141963 .182 .5722 OQSO for testRng.out using bits 16 to 20 141985 .257 .6012 OQSO for testRng.out using bits 15 to 19 141490 -1.421 .0776 OQSO for testRng.out using bits 14 to 18 142063 .521 .6988 OQSO for testRng.out using bits 13 to 17 141918 .029 .5117 OQSO for testRng.out using bits 12 to 16 142078 .572 .7163 OQSO for testRng.out using bits 11 to 15 141283 -2.123 .0169 OQSO for testRng.out using bits 10 to 14 142291 1.294 .9021 OQSO for testRng.out using bits 9 to 13 141542 -1.245 .1065 OQSO for testRng.out using bits 8 to 12 142262 1.195 .8841 OQSO for testRng.out using bits 7 to 11 141430 -1.625 .0521 OQSO for testRng.out using bits 6 to 10 142040 .443 .6711 OQSO for testRng.out using bits 5 to 9 141700 -.710 .2390 OQSO for testRng.out using bits 4 to 8 141432 -1.618 .0528 OQSO for testRng.out using bits 3 to 7 142013 .351 .6374 OQSO for testRng.out using bits 2 to 6 141824 -.289 .3862 OQSO for testRng.out using bits 1 to 5 142223 1.063 .8562 DNA test for generator testRng.out Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p DNA for testRng.out using bits 31 to 32 141869 -.119 .4527 DNA for testRng.out using bits 30 to 31 142170 .769 .7790 DNA for testRng.out using bits 29 to 30 141330 -1.709 .0437 DNA for testRng.out using bits 28 to 29 142414 1.489 .9317 DNA for testRng.out using bits 27 to 28 141315 -1.753 .0398 DNA for testRng.out using bits 26 to 27 141649 -.768 .2213 DNA for testRng.out using bits 25 to 26 142250 1.005 .8425 DNA for testRng.out using bits 24 to 25 141874 -.104 .4585 DNA for testRng.out using bits 23 to 24 141762 -.435 .3319 DNA for testRng.out using bits 22 to 23 141888 -.063 .4749 DNA for testRng.out using bits 21 to 22 141476 -1.278 .1006 DNA for testRng.out using bits 20 to 21 141705 -.603 .2733 DNA for testRng.out using bits 19 to 20 142510 1.772 .9618 DNA for testRng.out using bits 18 to 19 142019 .324 .6268 DNA for testRng.out using bits 17 to 18 142502 1.748 .9598 DNA for testRng.out using bits 16 to 17 141604 -.901 .1839 DNA for testRng.out using bits 15 to 16 142488 1.707 .9561 DNA for testRng.out using bits 14 to 15 141639 -.797 .2126 DNA for testRng.out using bits 13 to 14 142248 .999 .8411 DNA for testRng.out using bits 12 to 13 142092 .539 .7050 DNA for testRng.out using bits 11 to 12 141840 -.205 .4190 DNA for testRng.out using bits 10 to 11 141758 -.446 .3277 DNA for testRng.out using bits 9 to 10 142107 .583 .7201 DNA for testRng.out using bits 8 to 9 141693 -.638 .2617 DNA for testRng.out using bits 7 to 8 142161 .742 .7711 DNA for testRng.out using bits 6 to 7 142088 .527 .7009 DNA for testRng.out using bits 5 to 6 142433 1.545 .9388 DNA for testRng.out using bits 4 to 5 142335 1.256 .8954 DNA for testRng.out using bits 3 to 4 142030 .356 .6391 DNA for testRng.out using bits 2 to 3 141924 .043 .5173 DNA for testRng.out using bits 1 to 2 142459 1.621 .9475 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the COUNT-THE-1's TEST on a stream of bytes. :: :: Consider the file under test as a stream of bytes (four per :: :: 32 bit integer). Each byte can contain from 0 to 8 1's, :: :: with probabilities 1,8,28,56,70,56,28,8,1 over 256. Now let :: :: the stream of bytes provide a string of overlapping 5-letter :: :: words, each "letter" taking values A,B,C,D,E. The letters are :: :: determined by the number of 1's in a byte:: 0,1,or 2 yield A,:: :: 3 yields B, 4 yields C, 5 yields D and 6,7 or 8 yield E. Thus :: :: we have a monkey at a typewriter hitting five keys with vari- :: :: ous probabilities (37,56,70,56,37 over 256). There are 5^5 :: :: possible 5-letter words, and from a string of 256,000 (over- :: :: lapping) 5-letter words, counts are made on the frequencies :: :: for each word. The quadratic form in the weak inverse of :: :: the covariance matrix of the cell counts provides a chisquare :: :: test:: Q5-Q4, the difference of the naive Pearson sums of :: :: (OBS-EXP)^2/EXP on counts for 5- and 4-letter cell counts. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Test results for testRng.out Chi-square with 5^5-5^4=2500 d.of f. for sample size:2560000 chisquare equiv normal p-value Results fo COUNT-THE-1's in successive bytes: byte stream for testRng.out 2575.00 1.061 .855590 byte stream for testRng.out 2493.49 -.092 .463327 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the COUNT-THE-1's TEST for specific bytes. :: :: Consider the file under test as a stream of 32-bit integers. :: :: From each integer, a specific byte is chosen , say the left- :: :: most:: bits 1 to 8. Each byte can contain from 0 to 8 1's, :: :: with probabilitie 1,8,28,56,70,56,28,8,1 over 256. Now let :: :: the specified bytes from successive integers provide a string :: :: of (overlapping) 5-letter words, each "letter" taking values :: :: A,B,C,D,E. The letters are determined by the number of 1's, :: :: in that byte:: 0,1,or 2 ---> A, 3 ---> B, 4 ---> C, 5 ---> D,:: :: and 6,7 or 8 ---> E. Thus we have a monkey at a typewriter :: :: hitting five keys with with various probabilities:: 37,56,70,:: :: 56,37 over 256. There are 5^5 possible 5-letter words, and :: :: from a string of 256,000 (overlapping) 5-letter words, counts :: :: are made on the frequencies for each word. The quadratic form :: :: in the weak inverse of the covariance matrix of the cell :: :: counts provides a chisquare test:: Q5-Q4, the difference of :: :: the naive Pearson sums of (OBS-EXP)^2/EXP on counts for 5- :: :: and 4-letter cell counts. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Chi-square with 5^5-5^4=2500 d.of f. for sample size: 256000 chisquare equiv normal p value Results for COUNT-THE-1's in specified bytes: bits 1 to 8 2503.22 .045 .518138 bits 2 to 9 2608.94 1.541 .938302 bits 3 to 10 2476.70 -.329 .370895 bits 4 to 11 2466.35 -.476 .317056 bits 5 to 12 2352.67 -2.084 .018597 bits 6 to 13 2565.28 .923 .822040 bits 7 to 14 2551.29 .725 .765892 bits 8 to 15 2494.41 -.079 .468500 bits 9 to 16 2465.72 -.485 .313920 bits 10 to 17 2699.54 2.822 .997614 bits 11 to 18 2585.94 1.215 .887898 bits 12 to 19 2558.86 .832 .797400 bits 13 to 20 2463.44 -.517 .302574 bits 14 to 21 2311.85 -2.661 .003897 bits 15 to 22 2440.21 -.846 .198894 bits 16 to 23 2583.70 1.184 .881746 bits 17 to 24 2608.10 1.529 .936844 bits 18 to 25 2497.39 -.037 .485264 bits 19 to 26 2487.01 -.184 .427099 bits 20 to 27 2539.64 .561 .712471 bits 21 to 28 2532.64 .462 .677821 bits 22 to 29 2506.15 .087 .534664 bits 23 to 30 2528.68 .406 .657499 bits 24 to 31 2536.22 .512 .695770 bits 25 to 32 2489.84 -.144 .442875 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: THIS IS A PARKING LOT TEST :: :: In a square of side 100, randomly "park" a car---a circle of :: :: radius 1. Then try to park a 2nd, a 3rd, and so on, each :: :: time parking "by ear". That is, if an attempt to park a car :: :: causes a crash with one already parked, try again at a new :: :: random location. (To avoid path problems, consider parking :: :: helicopters rather than cars.) Each attempt leads to either :: :: a crash or a success, the latter followed by an increment to :: :: the list of cars already parked. If we plot n: the number of :: :: attempts, versus k:: the number successfully parked, we get a:: :: curve that should be similar to those provided by a perfect :: :: random number generator. Theory for the behavior of such a :: :: random curve seems beyond reach, and as graphics displays are :: :: not available for this battery of tests, a simple characteriz :: :: ation of the random experiment is used: k, the number of cars :: :: successfully parked after n=12,000 attempts. Simulation shows :: :: that k should average 3523 with sigma 21.9 and is very close :: :: to normally distributed. Thus (k-3523)/21.9 should be a st- :: :: andard normal variable, which, converted to a uniform varia- :: :: ble, provides input to a KSTEST based on a sample of 10. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: CDPARK: result of ten tests on file testRng.out Of 12,000 tries, the average no. of successes should be 3523 with sigma=21.9 Successes: 3497 z-score: -1.187 p-value: .117571 Successes: 3524 z-score: .046 p-value: .518210 Successes: 3495 z-score: -1.279 p-value: .100530 Successes: 3533 z-score: .457 p-value: .676028 Successes: 3514 z-score: -.411 p-value: .340551 Successes: 3555 z-score: 1.461 p-value: .928018 Successes: 3543 z-score: .913 p-value: .819442 Successes: 3530 z-score: .320 p-value: .625377 Successes: 3510 z-score: -.594 p-value: .276387 Successes: 3545 z-score: 1.005 p-value: .842447 square size avg. no. parked sample sigma 100. 3524.600 19.322 KSTEST for the above 10: p= .011841 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: THE MINIMUM DISTANCE TEST :: :: It does this 100 times:: choose n=8000 random points in a :: :: square of side 10000. Find d, the minimum distance between :: :: the (n^2-n)/2 pairs of points. If the points are truly inde- :: :: pendent uniform, then d^2, the square of the minimum distance :: :: should be (very close to) exponentially distributed with mean :: :: .995 . Thus 1-exp(-d^2/.995) should be uniform on [0,1) and :: :: a KSTEST on the resulting 100 values serves as a test of uni- :: :: formity for random points in the square. Test numbers=0 mod 5 :: :: are printed but the KSTEST is based on the full set of 100 :: :: random choices of 8000 points in the 10000x10000 square. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: This is the MINIMUM DISTANCE test for random integers in the file testRng.out Sample no. d^2 avg equiv uni 5 1.6550 .9611 .810488 10 2.2844 1.3180 .899329 15 .7372 1.1865 .523327 20 1.0709 1.1829 .659141 25 .7687 1.2306 .538194 30 1.8141 1.1809 .838496 35 1.8666 1.1289 .846788 40 .8750 1.1578 .584979 45 1.0229 1.0980 .642291 50 .1836 1.0945 .168512 55 .6243 1.0517 .466049 60 3.8486 1.1176 .979099 65 .3052 1.0771 .264123 70 .7730 1.0913 .540160 75 .3788 1.0515 .316651 80 .4580 1.0545 .368925 85 .3576 1.0164 .301898 90 1.2122 .9970 .704253 95 1.4869 1.0076 .775601 100 .0913 .9806 .087684 MINIMUM DISTANCE TEST for testRng.out Result of KS test on 20 transformed mindist^2's: p-value= .155793 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 testRng.out sample no: 1 r^3= 12.996 p-value= .35157 sample no: 2 r^3= 34.355 p-value= .68183 sample no: 3 r^3= 32.941 p-value= .66648 sample no: 4 r^3= 22.999 p-value= .53543 sample no: 5 r^3= 22.968 p-value= .53495 sample no: 6 r^3= 58.833 p-value= .85930 sample no: 7 r^3= 14.929 p-value= .39203 sample no: 8 r^3= 30.203 p-value= .63460 sample no: 9 r^3= 50.950 p-value= .81701 sample no: 10 r^3= 1.149 p-value= .03758 sample no: 11 r^3= 36.709 p-value= .70584 sample no: 12 r^3= 31.197 p-value= .64651 sample no: 13 r^3= 50.124 p-value= .81190 sample no: 14 r^3= .157 p-value= .00522 sample no: 15 r^3= 93.085 p-value= .95508 sample no: 16 r^3= 48.250 p-value= .79978 sample no: 17 r^3= 6.048 p-value= .18257 sample no: 18 r^3= 10.139 p-value= .28678 sample no: 19 r^3= 36.080 p-value= .69961 sample no: 20 r^3= 7.324 p-value= .21662 A KS test is applied to those 20 p-values. --------------------------------------------------------- 3DSPHERES test for file testRng.out p-value= .416980 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the SQEEZE test :: :: Random integers are floated to get uniforms on [0,1). Start- :: :: ing with k=2^31=2147483647, the test finds j, the number of :: :: iterations necessary to reduce k to 1, using the reduction :: :: k=ceiling(k*U), with U provided by floating integers from :: :: the file being tested. Such j's are found 100,000 times, :: :: then counts for the number of times j was <=6,7,...,47,>=48 :: :: are used to provide a chi-square test for cell frequencies. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: RESULTS OF SQUEEZE TEST FOR testRng.out Table of standardized frequency counts ( (obs-exp)/sqrt(exp) )^2 for j taking values <=6,7,8,...,47,>=48: -.8 -.3 -1.1 .8 -.8 -2.8 1.1 -1.2 -.1 -.4 .0 -1.2 1.3 .2 -.6 -.1 .2 -.1 .7 3.4 .0 -1.1 -.7 -1.8 .4 -.8 -.5 1.2 .4 -.2 1.2 -.8 -.5 -.9 1.3 .4 -1.6 -2.3 -.8 -1.8 .1 .0 -.1 Chi-square with 42 degrees of freedom: 53.984 z-score= 1.308 p-value= .898403 ______________________________________________________________ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: The OVERLAPPING SUMS test :: :: Integers are floated to get a sequence U(1),U(2),... of uni- :: :: form [0,1) variables. Then overlapping sums, :: :: S(1)=U(1)+...+U(100), S2=U(2)+...+U(101),... are formed. :: :: The S's are virtually normal with a certain covariance mat- :: :: rix. A linear transformation of the S's converts them to a :: :: sequence of independent standard normals, which are converted :: :: to uniform variables for a KSTEST. The p-values from ten :: :: KSTESTs are given still another KSTEST. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Test no. 1 p-value .569835 Test no. 2 p-value .918754 Test no. 3 p-value .032945 Test no. 4 p-value .984545 Test no. 5 p-value .832596 Test no. 6 p-value .394206 Test no. 7 p-value .802690 Test no. 8 p-value .352520 Test no. 9 p-value .453565 Test no. 10 p-value .271336 Results of the OSUM test for testRng.out KSTEST on the above 10 p-values: .252320 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the RUNS test. It counts runs up, and runs down, :: :: in a sequence of uniform [0,1) variables, obtained by float- :: :: ing the 32-bit integers in the specified file. This example :: :: shows how runs are counted: .123,.357,.789,.425,.224,.416,.95:: :: contains an up-run of length 3, a down-run of length 2 and an :: :: up-run of (at least) 2, depending on the next values. The :: :: covariance matrices for the runs-up and runs-down are well :: :: known, leading to chisquare tests for quadratic forms in the :: :: weak inverses of the covariance matrices. Runs are counted :: :: for sequences of length 10,000. This is done ten times. Then :: :: repeated. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: The RUNS test for file testRng.out Up and down runs in a sample of 10000 _________________________________________________ Run test for testRng.out : runs up; ks test for 10 p's: .933731 runs down; ks test for 10 p's: .705328 Run test for testRng.out : runs up; ks test for 10 p's: .065370 runs down; ks test for 10 p's: .266943 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: This is the CRAPS TEST. It plays 200,000 games of craps, finds:: :: the number of wins and the number of throws necessary to end :: :: each game. The number of wins should be (very close to) a :: :: normal with mean 200000p and variance 200000p(1-p), with :: :: p=244/495. Throws necessary to complete the game can vary :: :: from 1 to infinity, but counts for all>21 are lumped with 21. :: :: A chi-square test is made on the no.-of-throws cell counts. :: :: Each 32-bit integer from the test file provides the value for :: :: the throw of a die, by floating to [0,1), multiplying by 6 :: :: and taking 1 plus the integer part of the result. :: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Results of craps test for testRng.out No. of wins: Observed Expected 98707 98585.86 98707= No. of wins, z-score= .542 pvalue= .70603 Analysis of Throws-per-Game: Chisq= 16.15 for 20 degrees of freedom, p= .29244 Throws Observed Expected Chisq Sum 1 66543 66666.7 .229 .229 2 37715 37654.3 .098 .327 3 26879 26954.7 .213 .540 4 19458 19313.5 1.082 1.622 5 13708 13851.4 1.485 3.107 6 9891 9943.5 .278 3.384 7 7102 7145.0 .259 3.643 8 5200 5139.1 .722 4.366 9 3778 3699.9 1.650 6.016 10 2638 2666.3 .300 6.316 11 2008 1923.3 3.727 10.044 12 1405 1388.7 .190 10.234 13 1019 1003.7 .233 10.467 14 714 726.1 .203 10.670 15 559 525.8 2.092 12.761 16 397 381.2 .659 13.420 17 258 276.5 1.243 14.663 18 204 200.8 .050 14.713 19 152 146.0 .248 14.961 20 99 106.2 .490 15.451 21 273 287.1 .694 16.145 SUMMARY FOR testRng.out p-value for no. of wins: .706026 p-value for throws/game: .292437 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Results of DIEHARD battery of tests sent to file testRng.res