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 block1.rng For a sample of size 500: mean block1.rng using bits 1 to 24 2.016 duplicate number number spacings observed expected 0 56. 67.668 1 145. 135.335 2 141. 135.335 3 93. 90.224 4 40. 45.112 5 12. 18.045 6 to INF 13. 8.282 Chisquare with 6 d.o.f. = 8.32 p-value= .784188 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block1.rng using bits 2 to 25 2.038 duplicate number number spacings observed expected 0 66. 67.668 1 132. 135.335 2 140. 135.335 3 83. 90.224 4 51. 45.112 5 18. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = 1.99 p-value= .079160 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block1.rng using bits 3 to 26 1.930 duplicate number number spacings observed expected 0 73. 67.668 1 148. 135.335 2 145. 135.335 3 61. 90.224 4 42. 45.112 5 18. 18.045 6 to INF 13. 8.282 Chisquare with 6 d.o.f. = 14.66 p-value= .976961 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block1.rng using bits 4 to 27 1.912 duplicate number number spacings observed expected 0 81. 67.668 1 132. 135.335 2 141. 135.335 3 76. 90.224 4 48. 45.112 5 14. 18.045 6 to INF 8. 8.282 Chisquare with 6 d.o.f. = 6.29 p-value= .608453 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block1.rng using bits 5 to 28 1.996 duplicate number number spacings observed expected 0 63. 67.668 1 136. 135.335 2 141. 135.335 3 88. 90.224 4 52. 45.112 5 13. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 3.28 p-value= .226722 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block1.rng using bits 6 to 29 2.016 duplicate number number spacings observed expected 0 60. 67.668 1 133. 135.335 2 148. 135.335 3 89. 90.224 4 45. 45.112 5 19. 18.045 6 to INF 6. 8.282 Chisquare with 6 d.o.f. = 2.79 p-value= .165348 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block1.rng using bits 7 to 30 1.898 duplicate number number spacings observed expected 0 88. 67.668 1 127. 135.335 2 122. 135.335 3 92. 90.224 4 56. 45.112 5 13. 18.045 6 to INF 2. 8.282 Chisquare with 6 d.o.f. = 16.77 p-value= .989853 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block1.rng using bits 8 to 31 2.052 duplicate number number spacings observed expected 0 66. 67.668 1 126. 135.335 2 145. 135.335 3 91. 90.224 4 37. 45.112 5 23. 18.045 6 to INF 12. 8.282 Chisquare with 6 d.o.f. = 5.87 p-value= .562162 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block1.rng using bits 9 to 32 1.940 duplicate number number spacings observed expected 0 73. 67.668 1 141. 135.335 2 130. 135.335 3 96. 90.224 4 34. 45.112 5 14. 18.045 6 to INF 12. 8.282 Chisquare with 6 d.o.f. = 6.55 p-value= .635570 ::::::::::::::::::::::::::::::::::::::::: The 9 p-values were .784188 .079160 .976961 .608453 .226722 .165348 .989853 .562162 .635570 A KSTEST for the 9 p-values yields .514385 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block1.rng For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=111.433; p-value= .814967 OPERM5 test for file block1.rng For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=102.642; p-value= .619097 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block1.rng 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 208 211.4 .055259 .055 29 5183 5134.0 .467470 .523 30 23037 23103.0 .188814 .712 31 11572 11551.5 .036294 .748 chisquare= .748 for 3 d. of f.; p-value= .331683 -------------------------------------------------------------- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block1.rng 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 216 211.4 .099304 .099 30 5040 5134.0 1.721447 1.821 31 23289 23103.0 1.496710 3.317 32 11455 11551.5 .806557 4.124 chisquare= 4.124 for 3 d. of f.; p-value= .772759 -------------------------------------------------------------- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block1.rng Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 1 to 8 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 949 944.3 .023 .023 r =5 21640 21743.9 .496 .520 r =6 77411 77311.8 .127 .647 p=1-exp(-SUM/2)= .27643 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 2 to 9 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 961 944.3 .295 .295 r =5 21546 21743.9 1.801 2.096 r =6 77493 77311.8 .425 2.521 p=1-exp(-SUM/2)= .71651 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 3 to 10 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 953 944.3 .080 .080 r =5 21567 21743.9 1.439 1.519 r =6 77480 77311.8 .366 1.885 p=1-exp(-SUM/2)= .61040 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 4 to 11 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 962 944.3 .332 .332 r =5 21532 21743.9 2.065 2.397 r =6 77506 77311.8 .488 2.885 p=1-exp(-SUM/2)= .76361 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 5 to 12 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 950 944.3 .034 .034 r =5 21664 21743.9 .294 .328 r =6 77386 77311.8 .071 .399 p=1-exp(-SUM/2)= .18094 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 6 to 13 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 937 944.3 .056 .056 r =5 21659 21743.9 .331 .388 r =6 77404 77311.8 .110 .498 p=1-exp(-SUM/2)= .22038 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 7 to 14 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 901 944.3 1.986 1.986 r =5 21810 21743.9 .201 2.187 r =6 77289 77311.8 .007 2.193 p=1-exp(-SUM/2)= .66601 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 8 to 15 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 932 944.3 .160 .160 r =5 21701 21743.9 .085 .245 r =6 77367 77311.8 .039 .284 p=1-exp(-SUM/2)= .13251 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 9 to 16 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 978 944.3 1.203 1.203 r =5 21771 21743.9 .034 1.236 r =6 77251 77311.8 .048 1.284 p=1-exp(-SUM/2)= .47381 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 10 to 17 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1026 944.3 7.068 7.068 r =5 21771 21743.9 .034 7.102 r =6 77203 77311.8 .153 7.255 p=1-exp(-SUM/2)= .97342 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 11 to 18 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 959 944.3 .229 .229 r =5 21803 21743.9 .161 .389 r =6 77238 77311.8 .070 .460 p=1-exp(-SUM/2)= .20542 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 12 to 19 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 986 944.3 1.841 1.841 r =5 21643 21743.9 .468 2.310 r =6 77371 77311.8 .045 2.355 p=1-exp(-SUM/2)= .69193 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 13 to 20 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 991 944.3 2.309 2.309 r =5 21666 21743.9 .279 2.588 r =6 77343 77311.8 .013 2.601 p=1-exp(-SUM/2)= .72762 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 14 to 21 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 965 944.3 .454 .454 r =5 21684 21743.9 .165 .619 r =6 77351 77311.8 .020 .639 p=1-exp(-SUM/2)= .27334 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 15 to 22 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 919 944.3 .678 .678 r =5 21708 21743.9 .059 .737 r =6 77373 77311.8 .048 .786 p=1-exp(-SUM/2)= .32484 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 16 to 23 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 900 944.3 2.078 2.078 r =5 21586 21743.9 1.147 3.225 r =6 77514 77311.8 .529 3.754 p=1-exp(-SUM/2)= .84694 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 17 to 24 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 914 944.3 .972 .972 r =5 21643 21743.9 .468 1.441 r =6 77443 77311.8 .223 1.663 p=1-exp(-SUM/2)= .56464 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 18 to 25 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 989 944.3 2.116 2.116 r =5 21855 21743.9 .568 2.683 r =6 77156 77311.8 .314 2.997 p=1-exp(-SUM/2)= .77659 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 19 to 26 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1032 944.3 8.145 8.145 r =5 21790 21743.9 .098 8.242 r =6 77178 77311.8 .232 8.474 p=1-exp(-SUM/2)= .98555 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 20 to 27 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 939 944.3 .030 .030 r =5 21558 21743.9 1.589 1.619 r =6 77503 77311.8 .473 2.092 p=1-exp(-SUM/2)= .64865 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 21 to 28 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 964 944.3 .411 .411 r =5 21617 21743.9 .741 1.152 r =6 77419 77311.8 .149 1.300 p=1-exp(-SUM/2)= .47800 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 22 to 29 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 947 944.3 .008 .008 r =5 21627 21743.9 .628 .636 r =6 77426 77311.8 .169 .805 p=1-exp(-SUM/2)= .33131 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 23 to 30 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 939 944.3 .030 .030 r =5 21854 21743.9 .557 .587 r =6 77207 77311.8 .142 .729 p=1-exp(-SUM/2)= .30557 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 24 to 31 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1010 944.3 4.571 4.571 r =5 21818 21743.9 .253 4.823 r =6 77172 77311.8 .253 5.076 p=1-exp(-SUM/2)= .92099 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block1.rng b-rank test for bits 25 to 32 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 924 944.3 .436 .436 r =5 21847 21743.9 .489 .925 r =6 77229 77311.8 .089 1.014 p=1-exp(-SUM/2)= .39770 TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices These should be 25 uniform [0,1] random variables: .276434 .716507 .610395 .763609 .180941 .220379 .666005 .132506 .473809 .973421 .205421 .691935 .727615 .273340 .324845 .846937 .564643 .776588 .985549 .648652 .477998 .331311 .305568 .920986 .397697 brank test summary for block1.rng The KS test for those 25 supposed UNI's yields KS p-value= .414012 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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, N words This test uses N=2^21 and samples the bitstream 20 times. No. missing words should average 141909. with sigma=428. --------------------------------------------------------- tst no 1: 142400 missing words, 1.15 sigmas from mean, p-value= .87419 tst no 2: 141534 missing words, -.88 sigmas from mean, p-value= .19026 tst no 3: 142040 missing words, .31 sigmas from mean, p-value= .61993 tst no 4: 141799 missing words, -.26 sigmas from mean, p-value= .39829 tst no 5: 142154 missing words, .57 sigmas from mean, p-value= .71622 tst no 6: 141972 missing words, .15 sigmas from mean, p-value= .55821 tst no 7: 141667 missing words, -.57 sigmas from mean, p-value= .28563 tst no 8: 141822 missing words, -.20 sigmas from mean, p-value= .41916 tst no 9: 142618 missing words, 1.66 sigmas from mean, p-value= .95112 tst no 10: 142531 missing words, 1.45 sigmas from mean, p-value= .92682 tst no 11: 142052 missing words, .33 sigmas from mean, p-value= .63056 tst no 12: 141780 missing words, -.30 sigmas from mean, p-value= .38126 tst no 13: 141425 missing words, -1.13 sigmas from mean, p-value= .12890 tst no 14: 141711 missing words, -.46 sigmas from mean, p-value= .32154 tst no 15: 141938 missing words, .07 sigmas from mean, p-value= .52671 tst no 16: 141950 missing words, .10 sigmas from mean, p-value= .53785 tst no 17: 141412 missing words, -1.16 sigmas from mean, p-value= .12262 tst no 18: 141698 missing words, -.49 sigmas from mean, p-value= .31074 tst no 19: 142031 missing words, .28 sigmas from mean, p-value= .61190 tst no 20: 141678 missing words, -.54 sigmas from mean, p-value= .29443 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block1.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OPSO for block1.rng using bits 23 to 32 141950 .140 .5558 OPSO for block1.rng using bits 22 to 31 141581 -1.132 .1288 OPSO for block1.rng using bits 21 to 30 141494 -1.432 .0760 OPSO for block1.rng using bits 20 to 29 142281 1.282 .9000 OPSO for block1.rng using bits 19 to 28 141780 -.446 .3278 OPSO for block1.rng using bits 18 to 27 142163 .875 .8091 OPSO for block1.rng using bits 17 to 26 142118 .720 .7641 OPSO for block1.rng using bits 16 to 25 141461 -1.546 .0611 OPSO for block1.rng using bits 15 to 24 141481 -1.477 .0698 OPSO for block1.rng using bits 14 to 23 142264 1.223 .8893 OPSO for block1.rng using bits 13 to 22 141703 -.711 .2384 OPSO for block1.rng using bits 12 to 21 141614 -1.018 .1543 OPSO for block1.rng using bits 11 to 20 142151 .833 .7977 OPSO for block1.rng using bits 10 to 19 141895 -.049 .4803 OPSO for block1.rng using bits 9 to 18 141928 .064 .5257 OPSO for block1.rng using bits 8 to 17 142159 .861 .8054 OPSO for block1.rng using bits 7 to 16 142062 .526 .7007 OPSO for block1.rng using bits 6 to 15 141493 -1.436 .0756 OPSO for block1.rng using bits 5 to 14 141534 -1.294 .0978 OPSO for block1.rng using bits 4 to 13 142510 2.071 .9808 OPSO for block1.rng using bits 3 to 12 141904 -.018 .4927 OPSO for block1.rng using bits 2 to 11 141845 -.222 .4122 OPSO for block1.rng using bits 1 to 10 141676 -.805 .2105 OQSO test for generator block1.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OQSO for block1.rng using bits 28 to 32 142029 .406 .6575 OQSO for block1.rng using bits 27 to 31 141617 -.991 .1609 OQSO for block1.rng using bits 26 to 30 142139 .779 .7819 OQSO for block1.rng using bits 25 to 29 141704 -.696 .2432 OQSO for block1.rng using bits 24 to 28 142564 2.219 .9868 OQSO for block1.rng using bits 23 to 27 142138 .775 .7809 OQSO for block1.rng using bits 22 to 26 142211 1.023 .8468 OQSO for block1.rng using bits 21 to 25 141872 -.127 .4497 OQSO for block1.rng using bits 20 to 24 142263 1.199 .8847 OQSO for block1.rng using bits 19 to 23 141500 -1.388 .0826 OQSO for block1.rng using bits 18 to 22 141806 -.350 .3631 OQSO for block1.rng using bits 17 to 21 141569 -1.154 .1243 OQSO for block1.rng using bits 16 to 20 141600 -1.049 .1472 OQSO for block1.rng using bits 15 to 19 141782 -.432 .3330 OQSO for block1.rng using bits 14 to 18 142098 .640 .7388 OQSO for block1.rng using bits 13 to 17 141757 -.516 .3028 OQSO for block1.rng using bits 12 to 16 142065 .528 .7011 OQSO for block1.rng using bits 11 to 15 141791 -.401 .3442 OQSO for block1.rng using bits 10 to 14 142234 1.101 .8645 OQSO for block1.rng using bits 9 to 13 141474 -1.476 .0700 OQSO for block1.rng using bits 8 to 12 142218 1.046 .8523 OQSO for block1.rng using bits 7 to 11 141723 -.632 .2638 OQSO for block1.rng using bits 6 to 10 141865 -.150 .4403 OQSO for block1.rng using bits 5 to 9 141451 -1.554 .0601 OQSO for block1.rng using bits 4 to 8 141919 .033 .5131 OQSO for block1.rng using bits 3 to 7 142509 2.033 .9790 OQSO for block1.rng using bits 2 to 6 141629 -.950 .1710 OQSO for block1.rng using bits 1 to 5 141846 -.215 .4150 DNA test for generator block1.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p DNA for block1.rng using bits 31 to 32 141889 -.060 .4761 DNA for block1.rng using bits 30 to 31 141862 -.140 .4445 DNA for block1.rng using bits 29 to 30 141929 .058 .5231 DNA for block1.rng using bits 28 to 29 141466 -1.308 .0955 DNA for block1.rng using bits 27 to 28 141964 .161 .5641 DNA for block1.rng using bits 26 to 27 142123 .630 .7358 DNA for block1.rng using bits 25 to 26 141814 -.281 .3893 DNA for block1.rng using bits 24 to 25 141495 -1.222 .1108 DNA for block1.rng using bits 23 to 24 142149 .707 .7602 DNA for block1.rng using bits 22 to 23 141730 -.529 .2984 DNA for block1.rng using bits 21 to 22 142132 .657 .7444 DNA for block1.rng using bits 20 to 21 142298 1.147 .8742 DNA for block1.rng using bits 19 to 20 142103 .571 .7161 DNA for block1.rng using bits 18 to 19 142308 1.176 .8802 DNA for block1.rng using bits 17 to 18 141821 -.261 .3972 DNA for block1.rng using bits 16 to 17 142027 .347 .6357 DNA for block1.rng using bits 15 to 16 141820 -.264 .3961 DNA for block1.rng using bits 14 to 15 141978 .203 .5803 DNA for block1.rng using bits 13 to 14 142212 .893 .8140 DNA for block1.rng using bits 12 to 13 141838 -.210 .4167 DNA for block1.rng using bits 11 to 12 142587 1.999 .9772 DNA for block1.rng using bits 10 to 11 141981 .211 .5837 DNA for block1.rng using bits 9 to 10 141678 -.682 .2475 DNA for block1.rng using bits 8 to 9 141288 -1.833 .0334 DNA for block1.rng using bits 7 to 8 141794 -.340 .3669 DNA for block1.rng using bits 6 to 7 141596 -.924 .1777 DNA for block1.rng using bits 5 to 6 141716 -.570 .2842 DNA for block1.rng using bits 4 to 5 142093 .542 .7060 DNA for block1.rng using bits 3 to 4 142198 .852 .8028 DNA for block1.rng using bits 2 to 3 141994 .250 .5986 DNA for block1.rng using bits 1 to 2 141433 -1.405 .0800 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block1.rng 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 block1.rng 2564.22 .908 .818123 byte stream for block1.rng 2455.82 -.625 .266035 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 2406.97 -1.316 .094158 bits 2 to 9 2554.76 .774 .780651 bits 3 to 10 2421.51 -1.110 .133495 bits 4 to 11 2638.13 1.953 .974619 bits 5 to 12 2575.88 1.073 .858396 bits 6 to 13 2464.64 -.500 .308537 bits 7 to 14 2351.08 -2.106 .017601 bits 8 to 15 2460.40 -.560 .287714 bits 9 to 16 2503.57 .050 .520109 bits 10 to 17 2500.53 .007 .502989 bits 11 to 18 2551.73 .732 .767771 bits 12 to 19 2413.97 -1.217 .111859 bits 13 to 20 2539.52 .559 .711874 bits 14 to 21 2445.73 -.767 .221401 bits 15 to 22 2664.64 2.328 .990054 bits 16 to 23 2523.30 .330 .629128 bits 17 to 24 2459.51 -.573 .283460 bits 18 to 25 2410.58 -1.265 .103009 bits 19 to 26 2498.92 -.015 .493910 bits 20 to 27 2494.79 -.074 .470634 bits 21 to 28 2504.90 .069 .527640 bits 22 to 29 2337.90 -2.292 .010940 bits 23 to 30 2486.08 -.197 .421963 bits 24 to 31 2445.35 -.773 .219815 bits 25 to 32 2524.27 .343 .634262 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block1.rng Of 12,000 tries, the average no. of successes should be 3523 with sigma=21.9 Successes: 3529 z-score: .274 p-value: .607947 Successes: 3535 z-score: .548 p-value: .708135 Successes: 3527 z-score: .183 p-value: .572463 Successes: 3524 z-score: .046 p-value: .518210 Successes: 3524 z-score: .046 p-value: .518210 Successes: 3517 z-score: -.274 p-value: .392053 Successes: 3536 z-score: .594 p-value: .723613 Successes: 3505 z-score: -.822 p-value: .205562 Successes: 3519 z-score: -.183 p-value: .427537 Successes: 3516 z-score: -.320 p-value: .374623 square size avg. no. parked sample sigma 100. 3523.200 8.908 KSTEST for the above 10: p= .744364 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block1.rng Sample no. d^2 avg equiv uni 5 1.0065 1.5492 .636364 10 .2319 1.1350 .207893 15 .0331 .9154 .032708 20 1.6184 1.0570 .803390 25 4.1402 1.2587 .984408 30 1.6313 1.2451 .805924 35 1.2023 1.1596 .701304 40 3.4760 1.1402 .969604 45 .6647 1.0950 .487296 50 .3223 1.1371 .276722 55 .9412 1.0731 .611666 60 1.4237 1.0313 .760894 65 1.5687 1.0156 .793326 70 .6165 1.0044 .461818 75 2.1718 .9816 .887268 80 .0906 .9964 .086994 85 1.9667 1.0413 .861458 90 1.4027 1.0183 .755804 95 .5892 .9915 .446853 100 .7267 .9896 .518271 MINIMUM DISTANCE TEST for block1.rng Result of KS test on 20 transformed mindist^2's: p-value= .236388 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block1.rng sample no: 1 r^3= 14.966 p-value= .39278 sample no: 2 r^3= 43.029 p-value= .76172 sample no: 3 r^3= 8.329 p-value= .24242 sample no: 4 r^3= 45.484 p-value= .78044 sample no: 5 r^3= 23.237 p-value= .53910 sample no: 6 r^3= 1.065 p-value= .03486 sample no: 7 r^3= 5.846 p-value= .17706 sample no: 8 r^3= 67.995 p-value= .89632 sample no: 9 r^3= 51.001 p-value= .81732 sample no: 10 r^3= 55.741 p-value= .84402 sample no: 11 r^3= 4.885 p-value= .15028 sample no: 12 r^3= 25.221 p-value= .56859 sample no: 13 r^3= 54.727 p-value= .83866 sample no: 14 r^3= 3.484 p-value= .10965 sample no: 15 r^3= 25.865 p-value= .57776 sample no: 16 r^3= 1.602 p-value= .05200 sample no: 17 r^3= 32.831 p-value= .66525 sample no: 18 r^3= 2.263 p-value= .07265 sample no: 19 r^3= 40.078 p-value= .73709 sample no: 20 r^3= 43.991 p-value= .76924 A KS test is applied to those 20 p-values. --------------------------------------------------------- 3DSPHERES test for file block1.rng p-value= .414786 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block1.rng Table of standardized frequency counts ( (obs-exp)/sqrt(exp) )^2 for j taking values <=6,7,8,...,47,>=48: -.1 .5 1.1 -.3 -.1 .4 2.1 .3 -.4 .7 .6 .1 -.5 .7 -2.1 1.9 -.6 .7 -.2 -.3 .3 -.2 1.0 -1.7 .1 -.6 -.8 .1 -2.1 .9 .0 -.5 2.1 1.2 .6 -1.7 -.7 .5 -1.2 1.0 .9 -1.0 .8 Chi-square with 42 degrees of freedom: 42.412 z-score= .045 p-value= .546769 ______________________________________________________________ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 .185986 Test no. 2 p-value .704747 Test no. 3 p-value .338745 Test no. 4 p-value .919336 Test no. 5 p-value .820863 Test no. 6 p-value .600849 Test no. 7 p-value .973676 Test no. 8 p-value .549063 Test no. 9 p-value .335171 Test no. 10 p-value .705374 Results of the OSUM test for block1.rng KSTEST on the above 10 p-values: .602188 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block1.rng Up and down runs in a sample of 10000 _________________________________________________ Run test for block1.rng : runs up; ks test for 10 p's: .006170 runs down; ks test for 10 p's: .286105 Run test for block1.rng : runs up; ks test for 10 p's: .118531 runs down; ks test for 10 p's: .287039 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block1.rng No. of wins: Observed Expected 98704 98585.86 98704= No. of wins, z-score= .528 pvalue= .70139 Analysis of Throws-per-Game: Chisq= 24.22 for 20 degrees of freedom, p= .76713 Throws Observed Expected Chisq Sum 1 66272 66666.7 2.336 2.336 2 37680 37654.3 .018 2.354 3 27082 26954.7 .601 2.955 4 19479 19313.5 1.419 4.374 5 13915 13851.4 .292 4.666 6 10046 9943.5 1.056 5.721 7 7228 7145.0 .964 6.685 8 5064 5139.1 1.097 7.782 9 3705 3699.9 .007 7.789 10 2713 2666.3 .818 8.607 11 1901 1923.3 .259 8.866 12 1428 1388.7 1.110 9.976 13 921 1003.7 6.816 16.792 14 724 726.1 .006 16.799 15 523 525.8 .015 16.814 16 334 381.2 5.833 22.647 17 262 276.5 .764 23.411 18 202 200.8 .007 23.418 19 142 146.0 .109 23.527 20 106 106.2 .000 23.527 21 273 287.1 .694 24.221 SUMMARY FOR block1.rng p-value for no. of wins: .701387 p-value for throws/game: .767132 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Results of DIEHARD battery of tests sent to file report1.txt