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 black2d.bin For a sample of size 500: mean black2d.bin using bits 1 to 24 1.932 duplicate number number spacings observed expected 0 66. 67.668 1 133. 135.335 2 155. 135.335 3 89. 90.224 4 37. 45.112 5 13. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 6.02 p-value= .579347 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean black2d.bin using bits 2 to 25 2.090 duplicate number number spacings observed expected 0 76. 67.668 1 118. 135.335 2 124. 135.335 3 97. 90.224 4 51. 45.112 5 22. 18.045 6 to INF 12. 8.282 Chisquare with 6 d.o.f. = 8.01 p-value= .762609 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean black2d.bin using bits 3 to 26 2.008 duplicate number number spacings observed expected 0 55. 67.668 1 148. 135.335 2 138. 135.335 3 87. 90.224 4 47. 45.112 5 20. 18.045 6 to INF 5. 8.282 Chisquare with 6 d.o.f. = 5.32 p-value= .495986 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean black2d.bin using bits 4 to 27 2.012 duplicate number number spacings observed expected 0 67. 67.668 1 145. 135.335 2 121. 135.335 3 91. 90.224 4 45. 45.112 5 22. 18.045 6 to INF 9. 8.282 Chisquare with 6 d.o.f. = 3.15 p-value= .210387 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean black2d.bin using bits 5 to 28 2.010 duplicate number number spacings observed expected 0 59. 67.668 1 146. 135.335 2 135. 135.335 3 89. 90.224 4 45. 45.112 5 19. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 2.22 p-value= .101334 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean black2d.bin using bits 6 to 29 1.894 duplicate number number spacings observed expected 0 87. 67.668 1 125. 135.335 2 145. 135.335 3 78. 90.224 4 42. 45.112 5 13. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = 10.64 p-value= .899844 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean black2d.bin using bits 7 to 30 1.976 duplicate number number spacings observed expected 0 62. 67.668 1 147. 135.335 2 137. 135.335 3 91. 90.224 4 31. 45.112 5 25. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 8.80 p-value= .814915 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean black2d.bin using bits 8 to 31 2.032 duplicate number number spacings observed expected 0 72. 67.668 1 117. 135.335 2 136. 135.335 3 104. 90.224 4 46. 45.112 5 19. 18.045 6 to INF 6. 8.282 Chisquare with 6 d.o.f. = 5.57 p-value= .526369 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean black2d.bin using bits 9 to 32 2.074 duplicate number number spacings observed expected 0 59. 67.668 1 139. 135.335 2 137. 135.335 3 81. 90.224 4 53. 45.112 5 21. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = 4.39 p-value= .376305 ::::::::::::::::::::::::::::::::::::::::: The 9 p-values were .579347 .762609 .495986 .210387 .101334 .899844 .814915 .526369 .376305 A KSTEST for the 9 p-values yields .032714 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 black2d.bin For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=112.048; p-value= .825535 OPERM5 test for file black2d.bin For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=114.216; p-value= .859392 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 black2d.bin 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 229 211.4 1.462157 1.462 29 5160 5134.0 .131567 1.594 30 22973 23103.0 .732033 2.326 31 11638 11551.5 .647363 2.973 chisquare= 2.973 for 3 d. of f.; p-value= .646541 -------------------------------------------------------------- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 black2d.bin 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 222 211.4 .529654 .530 30 5190 5134.0 .610605 1.140 31 23013 23103.0 .350968 1.491 32 11575 11551.5 .047708 1.539 chisquare= 1.539 for 3 d. of f.; p-value= .434075 -------------------------------------------------------------- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 black2d.bin Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 1 to 8 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 935 944.3 .092 .092 r =5 21751 21743.9 .002 .094 r =6 77314 77311.8 .000 .094 p=1-exp(-SUM/2)= .04591 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 2 to 9 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 967 944.3 .546 .546 r =5 21715 21743.9 .038 .584 r =6 77318 77311.8 .000 .585 p=1-exp(-SUM/2)= .25343 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 3 to 10 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 940 944.3 .020 .020 r =5 21793 21743.9 .111 .130 r =6 77267 77311.8 .026 .156 p=1-exp(-SUM/2)= .07523 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 4 to 11 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 968 944.3 .595 .595 r =5 21853 21743.9 .547 1.142 r =6 77179 77311.8 .228 1.370 p=1-exp(-SUM/2)= .49598 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 5 to 12 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 912 944.3 1.105 1.105 r =5 22082 21743.9 5.257 6.362 r =6 77006 77311.8 1.210 7.572 p=1-exp(-SUM/2)= .97731 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 6 to 13 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 955 944.3 .121 .121 r =5 21892 21743.9 1.009 1.130 r =6 77153 77311.8 .326 1.456 p=1-exp(-SUM/2)= .51716 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 7 to 14 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 925 944.3 .395 .395 r =5 21836 21743.9 .390 .785 r =6 77239 77311.8 .069 .853 p=1-exp(-SUM/2)= .34727 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 8 to 15 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 930 944.3 .217 .217 r =5 22022 21743.9 3.557 3.773 r =6 77048 77311.8 .900 4.674 p=1-exp(-SUM/2)= .90336 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 9 to 16 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 990 944.3 2.212 2.212 r =5 21775 21743.9 .044 2.256 r =6 77235 77311.8 .076 2.332 p=1-exp(-SUM/2)= .68844 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 10 to 17 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 902 944.3 1.895 1.895 r =5 21810 21743.9 .201 2.096 r =6 77288 77311.8 .007 2.103 p=1-exp(-SUM/2)= .65062 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 11 to 18 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 959 944.3 .229 .229 r =5 21781 21743.9 .063 .292 r =6 77260 77311.8 .035 .327 p=1-exp(-SUM/2)= .15075 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 12 to 19 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 962 944.3 .332 .332 r =5 21748 21743.9 .001 .332 r =6 77290 77311.8 .006 .339 p=1-exp(-SUM/2)= .15576 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 13 to 20 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 946 944.3 .003 .003 r =5 21705 21743.9 .070 .073 r =6 77349 77311.8 .018 .091 p=1-exp(-SUM/2)= .04426 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 14 to 21 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 954 944.3 .100 .100 r =5 21745 21743.9 .000 .100 r =6 77301 77311.8 .002 .101 p=1-exp(-SUM/2)= .04933 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 15 to 22 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 973 944.3 .872 .872 r =5 21692 21743.9 .124 .996 r =6 77335 77311.8 .007 1.003 p=1-exp(-SUM/2)= .39439 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 16 to 23 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 899 944.3 2.173 2.173 r =5 21737 21743.9 .002 2.175 r =6 77364 77311.8 .035 2.211 p=1-exp(-SUM/2)= .66890 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 17 to 24 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 946 944.3 .003 .003 r =5 21895 21743.9 1.050 1.053 r =6 77159 77311.8 .302 1.355 p=1-exp(-SUM/2)= .49213 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 18 to 25 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 903 944.3 1.806 1.806 r =5 21943 21743.9 1.823 3.629 r =6 77154 77311.8 .322 3.952 p=1-exp(-SUM/2)= .86135 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 19 to 26 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 929 944.3 .248 .248 r =5 21698 21743.9 .097 .345 r =6 77373 77311.8 .048 .393 p=1-exp(-SUM/2)= .17851 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 20 to 27 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 959 944.3 .229 .229 r =5 21812 21743.9 .213 .442 r =6 77229 77311.8 .089 .531 p=1-exp(-SUM/2)= .23309 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 21 to 28 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 883 944.3 3.979 3.979 r =5 21877 21743.9 .815 4.794 r =6 77240 77311.8 .067 4.861 p=1-exp(-SUM/2)= .91200 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 22 to 29 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 907 944.3 1.473 1.473 r =5 21738 21743.9 .002 1.475 r =6 77355 77311.8 .024 1.499 p=1-exp(-SUM/2)= .52744 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 23 to 30 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 955 944.3 .121 .121 r =5 21560 21743.9 1.555 1.677 r =6 77485 77311.8 .388 2.065 p=1-exp(-SUM/2)= .64381 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 24 to 31 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 962 944.3 .332 .332 r =5 21569 21743.9 1.407 1.739 r =6 77469 77311.8 .320 2.058 p=1-exp(-SUM/2)= .64267 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG black2d.bin b-rank test for bits 25 to 32 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 894 944.3 2.679 2.679 r =5 21766 21743.9 .022 2.702 r =6 77340 77311.8 .010 2.712 p=1-exp(-SUM/2)= .74234 TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices These should be 25 uniform [0,1] random variables: .045911 .253430 .075234 .495983 .977310 .517158 .347267 .903363 .688442 .650623 .150752 .155763 .044263 .049331 .394390 .668902 .492133 .861348 .178510 .233087 .912004 .527442 .643806 .642668 .742337 brank test summary for black2d.bin The KS test for those 25 supposed UNI's yields KS p-value= .188197 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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: 141790 missing words, -.28 sigmas from mean, p-value= .39020 tst no 2: 141970 missing words, .14 sigmas from mean, p-value= .55636 tst no 3: 142444 missing words, 1.25 sigmas from mean, p-value= .89421 tst no 4: 141330 missing words, -1.35 sigmas from mean, p-value= .08794 tst no 5: 141405 missing words, -1.18 sigmas from mean, p-value= .11933 tst no 6: 142583 missing words, 1.57 sigmas from mean, p-value= .94226 tst no 7: 142589 missing words, 1.59 sigmas from mean, p-value= .94386 tst no 8: 141474 missing words, -1.02 sigmas from mean, p-value= .15455 tst no 9: 141087 missing words, -1.92 sigmas from mean, p-value= .02735 tst no 10: 141624 missing words, -.67 sigmas from mean, p-value= .25250 tst no 11: 141603 missing words, -.72 sigmas from mean, p-value= .23708 tst no 12: 142150 missing words, .56 sigmas from mean, p-value= .71305 tst no 13: 142170 missing words, .61 sigmas from mean, p-value= .72875 tst no 14: 141427 missing words, -1.13 sigmas from mean, p-value= .12989 tst no 15: 142099 missing words, .44 sigmas from mean, p-value= .67117 tst no 16: 142134 missing words, .52 sigmas from mean, p-value= .70019 tst no 17: 142520 missing words, 1.43 sigmas from mean, p-value= .92318 tst no 18: 141445 missing words, -1.08 sigmas from mean, p-value= .13899 tst no 19: 141539 missing words, -.87 sigmas from mean, p-value= .19345 tst no 20: 141560 missing words, -.82 sigmas from mean, p-value= .20720 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 black2d.bin Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OPSO for black2d.bin using bits 23 to 32 141966 .195 .5775 OPSO for black2d.bin using bits 22 to 31 142243 1.151 .8751 OPSO for black2d.bin using bits 21 to 30 141773 -.470 .3191 OPSO for black2d.bin using bits 20 to 29 141863 -.160 .4365 OPSO for black2d.bin using bits 19 to 28 142057 .509 .6947 OPSO for black2d.bin using bits 18 to 27 141811 -.339 .3673 OPSO for black2d.bin using bits 17 to 26 142016 .368 .6435 OPSO for black2d.bin using bits 16 to 25 141921 .040 .5161 OPSO for black2d.bin using bits 15 to 24 141586 -1.115 .1324 OPSO for black2d.bin using bits 14 to 23 141944 .120 .5476 OPSO for black2d.bin using bits 13 to 22 141744 -.570 .2843 OPSO for black2d.bin using bits 12 to 21 141424 -1.674 .0471 OPSO for black2d.bin using bits 11 to 20 142018 .375 .6461 OPSO for black2d.bin using bits 10 to 19 141767 -.491 .3118 OPSO for black2d.bin using bits 9 to 18 141929 .068 .5270 OPSO for black2d.bin using bits 8 to 17 141881 -.098 .4611 OPSO for black2d.bin using bits 7 to 16 142584 2.326 .9900 OPSO for black2d.bin using bits 6 to 15 141817 -.318 .3751 OPSO for black2d.bin using bits 5 to 14 141673 -.815 .2076 OPSO for black2d.bin using bits 4 to 13 142334 1.464 .9285 OPSO for black2d.bin using bits 3 to 12 142041 .454 .6751 OPSO for black2d.bin using bits 2 to 11 141863 -.160 .4365 OPSO for black2d.bin using bits 1 to 10 141682 -.784 .2166 OQSO test for generator black2d.bin Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OQSO for black2d.bin using bits 28 to 32 142426 1.751 .9601 OQSO for black2d.bin using bits 27 to 31 141992 .280 .6104 OQSO for black2d.bin using bits 26 to 30 142196 .972 .8344 OQSO for black2d.bin using bits 25 to 29 141738 -.581 .2807 OQSO for black2d.bin using bits 24 to 28 141671 -.808 .2096 OQSO for black2d.bin using bits 23 to 27 141878 -.106 .4577 OQSO for black2d.bin using bits 22 to 26 141723 -.632 .2638 OQSO for black2d.bin using bits 21 to 25 142027 .399 .6550 OQSO for black2d.bin using bits 20 to 24 141907 -.008 .4969 OQSO for black2d.bin using bits 19 to 23 142235 1.104 .8652 OQSO for black2d.bin using bits 18 to 22 141564 -1.171 .1209 OQSO for black2d.bin using bits 17 to 21 141413 -1.682 .0462 OQSO for black2d.bin using bits 16 to 20 141567 -1.160 .1229 OQSO for black2d.bin using bits 15 to 19 142397 1.653 .9508 OQSO for black2d.bin using bits 14 to 18 141645 -.896 .1851 OQSO for black2d.bin using bits 13 to 17 142408 1.690 .9545 OQSO for black2d.bin using bits 12 to 16 142237 1.111 .8667 OQSO for black2d.bin using bits 11 to 15 142043 .453 .6748 OQSO for black2d.bin using bits 10 to 14 141766 -.486 .3135 OQSO for black2d.bin using bits 9 to 13 141718 -.649 .2583 OQSO for black2d.bin using bits 8 to 12 141896 -.045 .4820 OQSO for black2d.bin using bits 7 to 11 142076 .565 .7140 OQSO for black2d.bin using bits 6 to 10 141288 -2.106 .0176 OQSO for black2d.bin using bits 5 to 9 141767 -.482 .3147 OQSO for black2d.bin using bits 4 to 8 141580 -1.116 .1321 OQSO for black2d.bin using bits 3 to 7 142003 .318 .6246 OQSO for black2d.bin using bits 2 to 6 141684 -.764 .2225 OQSO for black2d.bin using bits 1 to 5 141765 -.489 .3123 DNA test for generator black2d.bin Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p DNA for black2d.bin using bits 31 to 32 141463 -1.317 .0940 DNA for black2d.bin using bits 30 to 31 142501 1.745 .9595 DNA for black2d.bin using bits 29 to 30 141935 .076 .5302 DNA for black2d.bin using bits 28 to 29 142071 .477 .6833 DNA for black2d.bin using bits 27 to 28 141976 .197 .5780 DNA for black2d.bin using bits 26 to 27 142143 .689 .7547 DNA for black2d.bin using bits 25 to 26 141826 -.246 .4029 DNA for black2d.bin using bits 24 to 25 142125 .636 .7377 DNA for black2d.bin using bits 23 to 24 141965 .164 .5652 DNA for black2d.bin using bits 22 to 23 141751 -.467 .3202 DNA for black2d.bin using bits 21 to 22 141788 -.358 .3602 DNA for black2d.bin using bits 20 to 21 141525 -1.134 .1285 DNA for black2d.bin using bits 19 to 20 142133 .660 .7453 DNA for black2d.bin using bits 18 to 19 141361 -1.617 .0529 DNA for black2d.bin using bits 17 to 18 142060 .444 .6716 DNA for black2d.bin using bits 16 to 17 141512 -1.172 .1206 DNA for black2d.bin using bits 15 to 16 141993 .247 .5975 DNA for black2d.bin using bits 14 to 15 141781 -.379 .3525 DNA for black2d.bin using bits 13 to 14 141769 -.414 .3395 DNA for black2d.bin using bits 12 to 13 141583 -.963 .1679 DNA for black2d.bin using bits 11 to 12 142582 1.984 .9764 DNA for black2d.bin using bits 10 to 11 142517 1.793 .9635 DNA for black2d.bin using bits 9 to 10 141668 -.712 .2383 DNA for black2d.bin using bits 8 to 9 141653 -.756 .2248 DNA for black2d.bin using bits 7 to 8 141868 -.122 .4515 DNA for black2d.bin using bits 6 to 7 142021 .329 .6291 DNA for black2d.bin using bits 5 to 6 141760 -.440 .3298 DNA for black2d.bin using bits 4 to 5 141420 -1.443 .0744 DNA for black2d.bin using bits 3 to 4 142189 .825 .7953 DNA for black2d.bin using bits 2 to 3 141955 .135 .5536 DNA for black2d.bin using bits 1 to 2 142208 .881 .8109 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 black2d.bin 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 black2d.bin 2557.18 .809 .790637 byte stream for black2d.bin 2478.36 -.306 .379809 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 2492.83 -.101 .459593 bits 2 to 9 2533.53 .474 .682294 bits 3 to 10 2556.17 .794 .786490 bits 4 to 11 2389.00 -1.570 .058229 bits 5 to 12 2596.21 1.361 .913192 bits 6 to 13 2565.58 .927 .823141 bits 7 to 14 2443.36 -.801 .211571 bits 8 to 15 2612.15 1.586 .943643 bits 9 to 16 2447.68 -.740 .229687 bits 10 to 17 2425.79 -1.049 .146975 bits 11 to 18 2479.54 -.289 .386131 bits 12 to 19 2571.39 1.010 .843654 bits 13 to 20 2531.64 .447 .672702 bits 14 to 21 2438.63 -.868 .192715 bits 15 to 22 2474.14 -.366 .357273 bits 16 to 23 2703.23 2.874 .997974 bits 17 to 24 2567.90 .960 .831541 bits 18 to 25 2602.93 1.456 .927261 bits 19 to 26 2688.24 2.662 .996117 bits 20 to 27 2543.37 .613 .730196 bits 21 to 28 2490.68 -.132 .447591 bits 22 to 29 2417.34 -1.169 .121197 bits 23 to 30 2414.15 -1.214 .112341 bits 24 to 31 2511.87 .168 .566676 bits 25 to 32 2391.77 -1.531 .062932 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 black2d.bin Of 12,000 tries, the average no. of successes should be 3523 with sigma=21.9 Successes: 3545 z-score: 1.005 p-value: .842447 Successes: 3526 z-score: .137 p-value: .554479 Successes: 3538 z-score: .685 p-value: .753306 Successes: 3515 z-score: -.365 p-value: .357445 Successes: 3498 z-score: -1.142 p-value: .126820 Successes: 3506 z-score: -.776 p-value: .218799 Successes: 3524 z-score: .046 p-value: .518210 Successes: 3527 z-score: .183 p-value: .572463 Successes: 3543 z-score: .913 p-value: .819442 Successes: 3509 z-score: -.639 p-value: .261324 square size avg. no. parked sample sigma 100. 3523.100 15.166 KSTEST for the above 10: p= .093599 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 black2d.bin Sample no. d^2 avg equiv uni 5 .3028 1.1927 .262396 10 3.7290 1.4018 .976428 15 .6263 1.2560 .467087 20 7.8610 1.6409 .999629 25 1.0716 1.5384 .659382 30 8.6066 1.9281 .999825 35 .3923 1.8336 .325842 40 4.2492 1.8961 .986026 45 .1778 1.8892 .163650 50 .0118 1.7470 .011769 55 .6766 1.6271 .493363 60 1.2095 1.5618 .703475 65 .6779 1.5336 .494043 70 .6760 1.5771 .493087 75 2.1310 1.5171 .882547 80 .4584 1.4804 .369131 85 4.4803 1.5517 .988923 90 1.4954 1.5367 .777526 95 .3139 1.5724 .270590 100 .1374 1.5579 .128989 MINIMUM DISTANCE TEST for black2d.bin Result of KS test on 20 transformed mindist^2's: p-value= .998559 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 black2d.bin sample no: 1 r^3= 108.940 p-value= .97352 sample no: 2 r^3= 8.251 p-value= .24045 sample no: 3 r^3= 42.509 p-value= .75755 sample no: 4 r^3= 3.491 p-value= .10984 sample no: 5 r^3= 10.497 p-value= .29524 sample no: 6 r^3= 15.132 p-value= .39613 sample no: 7 r^3= 61.008 p-value= .86914 sample no: 8 r^3= 30.875 p-value= .64270 sample no: 9 r^3= 17.040 p-value= .43335 sample no: 10 r^3= 12.818 p-value= .34772 sample no: 11 r^3= 5.184 p-value= .15869 sample no: 12 r^3= 49.272 p-value= .80648 sample no: 13 r^3= 3.374 p-value= .10637 sample no: 14 r^3= 106.306 p-value= .97109 sample no: 15 r^3= 18.010 p-value= .45138 sample no: 16 r^3= 27.153 p-value= .59550 sample no: 17 r^3= 25.571 p-value= .57359 sample no: 18 r^3= 23.535 p-value= .54366 sample no: 19 r^3= 14.824 p-value= .38989 sample no: 20 r^3= 5.451 p-value= .16616 A KS test is applied to those 20 p-values. --------------------------------------------------------- 3DSPHERES test for file black2d.bin p-value= .089174 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 black2d.bin Table of standardized frequency counts ( (obs-exp)/sqrt(exp) )^2 for j taking values <=6,7,8,...,47,>=48: -.1 -.3 -.8 -1.1 -.6 .3 .6 1.1 .7 -1.6 -2.7 1.6 .0 .2 -1.1 1.8 -.2 -.5 .5 .5 -1.3 1.4 -.1 .9 -1.4 .2 -.7 .5 -1.5 .9 -.5 .6 -1.3 .5 1.7 .8 .0 -.7 .9 -.7 -.6 .0 -1.1 Chi-square with 42 degrees of freedom: 42.042 z-score= .005 p-value= .530804 ______________________________________________________________ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 .215306 Test no. 2 p-value .290172 Test no. 3 p-value .183235 Test no. 4 p-value .849680 Test no. 5 p-value .443007 Test no. 6 p-value .983402 Test no. 7 p-value .327040 Test no. 8 p-value .215601 Test no. 9 p-value .007884 Test no. 10 p-value .165486 Results of the OSUM test for black2d.bin KSTEST on the above 10 p-values: .871474 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 black2d.bin Up and down runs in a sample of 10000 _________________________________________________ Run test for black2d.bin : runs up; ks test for 10 p's: .140716 runs down; ks test for 10 p's: .441657 Run test for black2d.bin : runs up; ks test for 10 p's: .199966 runs down; ks test for 10 p's: .688735 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 black2d.bin No. of wins: Observed Expected 98587 98585.86 98587= No. of wins, z-score= .005 pvalue= .50204 Analysis of Throws-per-Game: Chisq= 16.10 for 20 degrees of freedom, p= .28989 Throws Observed Expected Chisq Sum 1 66765 66666.7 .145 .145 2 37620 37654.3 .031 .176 3 26790 26954.7 1.007 1.183 4 19276 19313.5 .073 1.256 5 13743 13851.4 .849 2.104 6 9947 9943.5 .001 2.106 7 7246 7145.0 1.427 3.533 8 5223 5139.1 1.371 4.903 9 3708 3699.9 .018 4.921 10 2748 2666.3 2.504 7.425 11 1928 1923.3 .011 7.436 12 1323 1388.7 3.112 10.548 13 1017 1003.7 .176 10.724 14 760 726.1 1.579 12.303 15 509 525.8 .539 12.842 16 368 381.2 .454 13.296 17 289 276.5 .561 13.857 18 185 200.8 1.248 15.105 19 145 146.0 .007 15.111 20 106 106.2 .000 15.112 21 304 287.1 .993 16.105 SUMMARY FOR black2d.bin p-value for no. of wins: .502035 p-value for throws/game: .289893 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Results of DIEHARD battery of tests sent to file black2d.out