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 block6.rng For a sample of size 500: mean block6.rng using bits 1 to 24 1.916 duplicate number number spacings observed expected 0 71. 67.668 1 145. 135.335 2 143. 135.335 3 74. 90.224 4 41. 45.112 5 18. 18.045 6 to INF 8. 8.282 Chisquare with 6 d.o.f. = 4.59 p-value= .402646 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block6.rng using bits 2 to 25 2.010 duplicate number number spacings observed expected 0 65. 67.668 1 148. 135.335 2 122. 135.335 3 83. 90.224 4 56. 45.112 5 17. 18.045 6 to INF 9. 8.282 Chisquare with 6 d.o.f. = 5.93 p-value= .569311 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block6.rng using bits 3 to 26 1.926 duplicate number number spacings observed expected 0 74. 67.668 1 135. 135.335 2 137. 135.335 3 92. 90.224 4 37. 45.112 5 21. 18.045 6 to INF 4. 8.282 Chisquare with 6 d.o.f. = 4.81 p-value= .430976 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block6.rng using bits 4 to 27 2.066 duplicate number number spacings observed expected 0 64. 67.668 1 122. 135.335 2 139. 135.335 3 101. 90.224 4 48. 45.112 5 20. 18.045 6 to INF 6. 8.282 Chisquare with 6 d.o.f. = 3.92 p-value= .313129 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block6.rng using bits 5 to 28 1.996 duplicate number number spacings observed expected 0 63. 67.668 1 138. 135.335 2 143. 135.335 3 86. 90.224 4 43. 45.112 5 18. 18.045 6 to INF 9. 8.282 Chisquare with 6 d.o.f. = 1.17 p-value= .021540 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block6.rng using bits 6 to 29 1.978 duplicate number number spacings observed expected 0 64. 67.668 1 139. 135.335 2 142. 135.335 3 83. 90.224 4 52. 45.112 5 13. 18.045 6 to INF 7. 8.282 Chisquare with 6 d.o.f. = 3.87 p-value= .305071 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block6.rng using bits 7 to 30 2.010 duplicate number number spacings observed expected 0 71. 67.668 1 135. 135.335 2 122. 135.335 3 98. 90.224 4 45. 45.112 5 25. 18.045 6 to INF 4. 8.282 Chisquare with 6 d.o.f. = 7.04 p-value= .683215 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block6.rng using bits 8 to 31 2.044 duplicate number number spacings observed expected 0 60. 67.668 1 145. 135.335 2 134. 135.335 3 82. 90.224 4 45. 45.112 5 24. 18.045 6 to INF 10. 8.282 Chisquare with 6 d.o.f. = 4.64 p-value= .409776 ::::::::::::::::::::::::::::::::::::::::: For a sample of size 500: mean block6.rng using bits 9 to 32 1.918 duplicate number number spacings observed expected 0 53. 67.668 1 157. 135.335 2 148. 135.335 3 80. 90.224 4 47. 45.112 5 12. 18.045 6 to INF 3. 8.282 Chisquare with 6 d.o.f. = 14.46 p-value= .975134 ::::::::::::::::::::::::::::::::::::::::: The 9 p-values were .402646 .569311 .430976 .313129 .021540 .305071 .683215 .409776 .975134 A KSTEST for the 9 p-values yields .388399 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block6.rng For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=111.188; p-value= .810631 OPERM5 test for file block6.rng For a sample of 1,000,000 consecutive 5-tuples, chisquare for 99 degrees of freedom=131.353; p-value= .983563 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block6.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 204 211.4 .260276 .260 29 4988 5134.0 4.152503 4.413 30 23265 23103.0 1.135297 5.548 31 11543 11551.5 .006291 5.554 chisquare= 5.554 for 3 d. of f.; p-value= .873795 -------------------------------------------------------------- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block6.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 229 211.4 1.462156 1.462 30 5204 5134.0 .954140 2.416 31 23050 23103.0 .121801 2.538 32 11517 11551.5 .103184 2.641 chisquare= 2.641 for 3 d. of f.; p-value= .601762 -------------------------------------------------------------- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block6.rng Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng b-rank test for bits 1 to 8 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 947 944.3 .008 .008 r =5 21706 21743.9 .066 .074 r =6 77347 77311.8 .016 .090 p=1-exp(-SUM/2)= .04391 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng b-rank test for bits 2 to 9 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 975 944.3 .998 .998 r =5 21581 21743.9 1.220 2.218 r =6 77444 77311.8 .226 2.444 p=1-exp(-SUM/2)= .70543 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng b-rank test for bits 3 to 10 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 963 944.3 .370 .370 r =5 21804 21743.9 .166 .536 r =6 77233 77311.8 .080 .617 p=1-exp(-SUM/2)= .26534 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng 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 21923 21743.9 1.475 3.461 r =6 77176 77311.8 .239 3.699 p=1-exp(-SUM/2)= .84271 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng b-rank test for bits 5 to 12 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 936 944.3 .073 .073 r =5 21862 21743.9 .641 .714 r =6 77202 77311.8 .156 .870 p=1-exp(-SUM/2)= .35286 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng b-rank test for bits 6 to 13 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 935 944.3 .092 .092 r =5 22056 21743.9 4.480 4.571 r =6 77009 77311.8 1.186 5.757 p=1-exp(-SUM/2)= .94379 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng b-rank test for bits 7 to 14 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 964 944.3 .411 .411 r =5 21824 21743.9 .295 .706 r =6 77212 77311.8 .129 .835 p=1-exp(-SUM/2)= .34126 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng b-rank test for bits 8 to 15 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 944 944.3 .000 .000 r =5 21679 21743.9 .194 .194 r =6 77377 77311.8 .055 .249 p=1-exp(-SUM/2)= .11697 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng b-rank test for bits 9 to 16 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 898 944.3 2.270 2.270 r =5 21801 21743.9 .150 2.420 r =6 77301 77311.8 .002 2.422 p=1-exp(-SUM/2)= .70206 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng b-rank test for bits 10 to 17 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 980 944.3 1.350 1.350 r =5 21645 21743.9 .450 1.799 r =6 77375 77311.8 .052 1.851 p=1-exp(-SUM/2)= .60368 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng b-rank test for bits 11 to 18 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 953 944.3 .080 .080 r =5 21719 21743.9 .029 .109 r =6 77328 77311.8 .003 .112 p=1-exp(-SUM/2)= .05448 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng b-rank test for bits 12 to 19 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 906 944.3 1.554 1.554 r =5 21700 21743.9 .089 1.642 r =6 77394 77311.8 .087 1.730 p=1-exp(-SUM/2)= .57885 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng b-rank test for bits 13 to 20 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 917 944.3 .789 .789 r =5 21684 21743.9 .165 .954 r =6 77399 77311.8 .098 1.053 p=1-exp(-SUM/2)= .40924 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng b-rank test for bits 14 to 21 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 953 944.3 .080 .080 r =5 21869 21743.9 .720 .800 r =6 77178 77311.8 .232 1.031 p=1-exp(-SUM/2)= .40293 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng b-rank test for bits 15 to 22 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 958 944.3 .199 .199 r =5 21807 21743.9 .183 .382 r =6 77235 77311.8 .076 .458 p=1-exp(-SUM/2)= .20473 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng b-rank test for bits 16 to 23 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 block6.rng b-rank test for bits 17 to 24 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 975 944.3 .998 .998 r =5 21565 21743.9 1.472 2.470 r =6 77460 77311.8 .284 2.754 p=1-exp(-SUM/2)= .74766 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng b-rank test for bits 18 to 25 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 969 944.3 .646 .646 r =5 21843 21743.9 .452 1.098 r =6 77188 77311.8 .198 1.296 p=1-exp(-SUM/2)= .47689 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng b-rank test for bits 19 to 26 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 934 944.3 .112 .112 r =5 21814 21743.9 .226 .338 r =6 77252 77311.8 .046 .385 p=1-exp(-SUM/2)= .17495 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng b-rank test for bits 20 to 27 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 959 944.3 .229 .229 r =5 22044 21743.9 4.142 4.371 r =6 76997 77311.8 1.282 5.652 p=1-exp(-SUM/2)= .94077 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng b-rank test for bits 21 to 28 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 961 944.3 .295 .295 r =5 21809 21743.9 .195 .490 r =6 77230 77311.8 .087 .577 p=1-exp(-SUM/2)= .25052 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng b-rank test for bits 22 to 29 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 936 944.3 .073 .073 r =5 21668 21743.9 .265 .338 r =6 77396 77311.8 .092 .430 p=1-exp(-SUM/2)= .19330 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng b-rank test for bits 23 to 30 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 942 944.3 .006 .006 r =5 21541 21743.9 1.893 1.899 r =6 77517 77311.8 .545 2.444 p=1-exp(-SUM/2)= .70530 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng b-rank test for bits 24 to 31 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 1005 944.3 3.902 3.902 r =5 21627 21743.9 .628 4.530 r =6 77368 77311.8 .041 4.571 p=1-exp(-SUM/2)= .89828 Rank of a 6x8 binary matrix, rows formed from eight bits of the RNG block6.rng b-rank test for bits 25 to 32 OBSERVED EXPECTED (O-E)^2/E SUM r<=4 933 944.3 .135 .135 r =5 21842 21743.9 .443 .578 r =6 77225 77311.8 .097 .675 p=1-exp(-SUM/2)= .28656 TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices These should be 25 uniform [0,1] random variables: .043905 .705426 .265344 .842712 .352857 .943789 .341255 .116967 .702058 .603680 .054479 .578851 .409237 .402932 .204726 .324845 .747664 .476888 .174953 .940765 .250522 .193301 .705295 .898276 .286555 brank test summary for block6.rng The KS test for those 25 supposed UNI's yields KS p-value= .199101 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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: 142200 missing words, .68 sigmas from mean, p-value= .75148 tst no 2: 142225 missing words, .74 sigmas from mean, p-value= .76961 tst no 3: 141968 missing words, .14 sigmas from mean, p-value= .55452 tst no 4: 142316 missing words, .95 sigmas from mean, p-value= .82899 tst no 5: 141928 missing words, .04 sigmas from mean, p-value= .51740 tst no 6: 141668 missing words, -.56 sigmas from mean, p-value= .28643 tst no 7: 141738 missing words, -.40 sigmas from mean, p-value= .34447 tst no 8: 142447 missing words, 1.26 sigmas from mean, p-value= .89549 tst no 9: 141747 missing words, -.38 sigmas from mean, p-value= .35224 tst no 10: 142046 missing words, .32 sigmas from mean, p-value= .62526 tst no 11: 141714 missing words, -.46 sigmas from mean, p-value= .32406 tst no 12: 141939 missing words, .07 sigmas from mean, p-value= .52764 tst no 13: 141390 missing words, -1.21 sigmas from mean, p-value= .11249 tst no 14: 141639 missing words, -.63 sigmas from mean, p-value= .26382 tst no 15: 142330 missing words, .98 sigmas from mean, p-value= .83717 tst no 16: 142102 missing words, .45 sigmas from mean, p-value= .67371 tst no 17: 141415 missing words, -1.15 sigmas from mean, p-value= .12405 tst no 18: 142447 missing words, 1.26 sigmas from mean, p-value= .89549 tst no 19: 140808 missing words, -2.57 sigmas from mean, p-value= .00504 tst no 20: 141488 missing words, -.98 sigmas from mean, p-value= .16246 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block6.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OPSO for block6.rng using bits 23 to 32 141579 -1.139 .1273 OPSO for block6.rng using bits 22 to 31 142028 .409 .6588 OPSO for block6.rng using bits 21 to 30 141593 -1.091 .1377 OPSO for block6.rng using bits 20 to 29 141516 -1.356 .0875 OPSO for block6.rng using bits 19 to 28 142213 1.047 .8525 OPSO for block6.rng using bits 18 to 27 142043 .461 .6776 OPSO for block6.rng using bits 17 to 26 141772 -.474 .3179 OPSO for block6.rng using bits 16 to 25 141778 -.453 .3253 OPSO for block6.rng using bits 15 to 24 141650 -.894 .1856 OPSO for block6.rng using bits 14 to 23 141720 -.653 .2569 OPSO for block6.rng using bits 13 to 22 141570 -1.170 .1210 OPSO for block6.rng using bits 12 to 21 141997 .302 .6188 OPSO for block6.rng using bits 11 to 20 142171 .902 .8166 OPSO for block6.rng using bits 10 to 19 142010 .347 .6358 OPSO for block6.rng using bits 9 to 18 141785 -.429 .3341 OPSO for block6.rng using bits 8 to 17 141940 .106 .5421 OPSO for block6.rng using bits 7 to 16 141881 -.098 .4611 OPSO for block6.rng using bits 6 to 15 141823 -.298 .3830 OPSO for block6.rng using bits 5 to 14 141844 -.225 .4109 OPSO for block6.rng using bits 4 to 13 142206 1.023 .8468 OPSO for block6.rng using bits 3 to 12 141934 .085 .5339 OPSO for block6.rng using bits 2 to 11 142040 .451 .6739 OPSO for block6.rng using bits 1 to 10 142049 .482 .6850 OQSO test for generator block6.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p OQSO for block6.rng using bits 28 to 32 141314 -2.018 .0218 OQSO for block6.rng using bits 27 to 31 141935 .087 .5347 OQSO for block6.rng using bits 26 to 30 142064 .524 .7000 OQSO for block6.rng using bits 25 to 29 142213 1.029 .8484 OQSO for block6.rng using bits 24 to 28 141289 -2.103 .0177 OQSO for block6.rng using bits 23 to 27 141555 -1.201 .1149 OQSO for block6.rng using bits 22 to 26 141848 -.208 .4177 OQSO for block6.rng using bits 21 to 25 141873 -.123 .4510 OQSO for block6.rng using bits 20 to 24 141990 .273 .6078 OQSO for block6.rng using bits 19 to 23 142006 .328 .6284 OQSO for block6.rng using bits 18 to 22 141602 -1.042 .1488 OQSO for block6.rng using bits 17 to 21 142553 2.182 .9854 OQSO for block6.rng using bits 16 to 20 142544 2.151 .9843 OQSO for block6.rng using bits 15 to 19 141873 -.123 .4510 OQSO for block6.rng using bits 14 to 18 141536 -1.266 .1028 OQSO for block6.rng using bits 13 to 17 142023 .385 .6500 OQSO for block6.rng using bits 12 to 16 141853 -.191 .4243 OQSO for block6.rng using bits 11 to 15 142224 1.067 .8569 OQSO for block6.rng using bits 10 to 14 142137 .772 .7799 OQSO for block6.rng using bits 9 to 13 141535 -1.269 .1022 OQSO for block6.rng using bits 8 to 12 142452 1.840 .9671 OQSO for block6.rng using bits 7 to 11 141546 -1.232 .1090 OQSO for block6.rng using bits 6 to 10 141933 .080 .5320 OQSO for block6.rng using bits 5 to 9 141598 -1.055 .1456 OQSO for block6.rng using bits 4 to 8 141933 .080 .5320 OQSO for block6.rng using bits 3 to 7 141678 -.784 .2165 OQSO for block6.rng using bits 2 to 6 141525 -1.303 .0963 OQSO for block6.rng using bits 1 to 5 142615 2.392 .9916 DNA test for generator block6.rng Output: No. missing words (mw), equiv normal variate (z), p-value (p) mw z p DNA for block6.rng using bits 31 to 32 141417 -1.452 .0732 DNA for block6.rng using bits 30 to 31 142214 .899 .8156 DNA for block6.rng using bits 29 to 30 142038 .380 .6479 DNA for block6.rng using bits 28 to 29 142208 .881 .8109 DNA for block6.rng using bits 27 to 28 142426 1.524 .9363 DNA for block6.rng using bits 26 to 27 141704 -.606 .2724 DNA for block6.rng using bits 25 to 26 142381 1.391 .9179 DNA for block6.rng using bits 24 to 25 141701 -.615 .2694 DNA for block6.rng using bits 23 to 24 142267 1.055 .8543 DNA for block6.rng using bits 22 to 23 142111 .595 .7240 DNA for block6.rng using bits 21 to 22 141640 -.794 .2135 DNA for block6.rng using bits 20 to 21 142003 .276 .6088 DNA for block6.rng using bits 19 to 20 142226 .934 .8249 DNA for block6.rng using bits 18 to 19 142126 .639 .7386 DNA for block6.rng using bits 17 to 18 142097 .554 .7101 DNA for block6.rng using bits 16 to 17 141257 -1.924 .0272 DNA for block6.rng using bits 15 to 16 142182 .804 .7894 DNA for block6.rng using bits 14 to 15 141529 -1.122 .1309 DNA for block6.rng using bits 13 to 14 141295 -1.812 .0350 DNA for block6.rng using bits 12 to 13 141449 -1.358 .0872 DNA for block6.rng using bits 11 to 12 142583 1.987 .9766 DNA for block6.rng using bits 10 to 11 142362 1.335 .9091 DNA for block6.rng using bits 9 to 10 142347 1.291 .9017 DNA for block6.rng using bits 8 to 9 141719 -.561 .2872 DNA for block6.rng using bits 7 to 8 142138 .675 .7500 DNA for block6.rng using bits 6 to 7 141281 -1.853 .0319 DNA for block6.rng using bits 5 to 6 142163 .748 .7729 DNA for block6.rng using bits 4 to 5 141434 -1.402 .0804 DNA for block6.rng using bits 3 to 4 141758 -.446 .3277 DNA for block6.rng using bits 2 to 3 141940 .090 .5360 DNA for block6.rng using bits 1 to 2 142016 .315 .6235 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block6.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 block6.rng 2538.34 .542 .706167 byte stream for block6.rng 2490.07 -.140 .444178 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 2419.56 -1.138 .127633 bits 2 to 9 2512.94 .183 .572592 bits 3 to 10 2502.42 .034 .513622 bits 4 to 11 2358.81 -1.997 .022928 bits 5 to 12 2552.97 .749 .773104 bits 6 to 13 2418.89 -1.147 .125672 bits 7 to 14 2541.83 .592 .722935 bits 8 to 15 2421.25 -1.114 .132696 bits 9 to 16 2504.60 .065 .525929 bits 10 to 17 2361.67 -1.956 .025216 bits 11 to 18 2636.87 1.936 .973543 bits 12 to 19 2554.43 .770 .779274 bits 13 to 20 2490.80 -.130 .448249 bits 14 to 21 2397.33 -1.452 .073247 bits 15 to 22 2590.43 1.279 .899540 bits 16 to 23 2452.54 -.671 .251056 bits 17 to 24 2563.16 .893 .814139 bits 18 to 25 2469.13 -.437 .331214 bits 19 to 26 2568.96 .975 .835283 bits 20 to 27 2468.41 -.447 .327504 bits 21 to 28 2480.98 -.269 .393993 bits 22 to 29 2613.70 1.608 .946079 bits 23 to 30 2635.35 1.914 .972201 bits 24 to 31 2480.06 -.282 .388962 bits 25 to 32 2574.81 1.058 .854972 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block6.rng Of 12,000 tries, the average no. of successes should be 3523 with sigma=21.9 Successes: 3520 z-score: -.137 p-value: .445521 Successes: 3543 z-score: .913 p-value: .819442 Successes: 3509 z-score: -.639 p-value: .261324 Successes: 3522 z-score: -.046 p-value: .481790 Successes: 3501 z-score: -1.005 p-value: .157553 Successes: 3517 z-score: -.274 p-value: .392053 Successes: 3493 z-score: -1.370 p-value: .085365 Successes: 3527 z-score: .183 p-value: .572463 Successes: 3515 z-score: -.365 p-value: .357445 Successes: 3491 z-score: -1.461 p-value: .071982 square size avg. no. parked sample sigma 100. 3513.800 15.098 KSTEST for the above 10: p= .780431 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block6.rng Sample no. d^2 avg equiv uni 5 .8373 1.2477 .568938 10 .2615 .7447 .231089 15 .3222 .8470 .276603 20 .3293 .7405 .281760 25 .8094 .7324 .556671 30 1.5835 .8458 .796370 35 1.6999 .8546 .818850 40 1.6143 .8828 .802586 45 .2280 .8792 .204765 50 .7023 .9437 .506296 55 .1686 .8916 .155858 60 .2770 .9191 .243006 65 .2577 .9762 .228178 70 .0445 .9167 .043757 75 .4939 .9254 .391254 80 1.2292 .9250 .709286 85 .9900 .9105 .630264 90 .1601 .9159 .148615 95 .0992 .8776 .094906 100 2.6976 .9206 .933539 MINIMUM DISTANCE TEST for block6.rng Result of KS test on 20 transformed mindist^2's: p-value= .233572 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block6.rng sample no: 1 r^3= 54.287 p-value= .83627 sample no: 2 r^3= 30.124 p-value= .63364 sample no: 3 r^3= 28.748 p-value= .61644 sample no: 4 r^3= 4.407 p-value= .13663 sample no: 5 r^3= 4.243 p-value= .13189 sample no: 6 r^3= 26.822 p-value= .59101 sample no: 7 r^3= 46.478 p-value= .78759 sample no: 8 r^3= 12.604 p-value= .34303 sample no: 9 r^3= 34.737 p-value= .68586 sample no: 10 r^3= 8.896 p-value= .25661 sample no: 11 r^3= .308 p-value= .01022 sample no: 12 r^3= 37.168 p-value= .71031 sample no: 13 r^3= 6.282 p-value= .18893 sample no: 14 r^3= 11.910 p-value= .32766 sample no: 15 r^3= 44.415 p-value= .77248 sample no: 16 r^3= 34.185 p-value= .68002 sample no: 17 r^3= 38.573 p-value= .72356 sample no: 18 r^3= 45.426 p-value= .78002 sample no: 19 r^3= 8.581 p-value= .24876 sample no: 20 r^3= 5.272 p-value= .16117 A KS test is applied to those 20 p-values. --------------------------------------------------------- 3DSPHERES test for file block6.rng p-value= .461227 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block6.rng Table of standardized frequency counts ( (obs-exp)/sqrt(exp) )^2 for j taking values <=6,7,8,...,47,>=48: -1.5 -.7 -.1 -1.6 2.6 .3 .5 .8 .0 1.1 -.8 -.8 .9 .7 -1.6 1.4 .2 -.3 -.5 -1.1 -.6 .4 -.3 2.8 -1.5 -.2 -.1 -.4 -.9 .0 .5 2.7 -1.1 -.3 -.1 .8 .5 -1.3 .1 .4 .9 2.0 -.1 Chi-square with 42 degrees of freedom: 50.856 z-score= .966 p-value= .835971 ______________________________________________________________ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 .467835 Test no. 2 p-value .684353 Test no. 3 p-value .765742 Test no. 4 p-value .667671 Test no. 5 p-value .748993 Test no. 6 p-value .676145 Test no. 7 p-value .356360 Test no. 8 p-value .606335 Test no. 9 p-value .297356 Test no. 10 p-value .757876 Results of the OSUM test for block6.rng KSTEST on the above 10 p-values: .870741 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block6.rng Up and down runs in a sample of 10000 _________________________________________________ Run test for block6.rng : runs up; ks test for 10 p's: .095465 runs down; ks test for 10 p's: .728443 Run test for block6.rng : runs up; ks test for 10 p's: .408193 runs down; ks test for 10 p's: .164630 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: 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 block6.rng No. of wins: Observed Expected 98798 98585.86 98798= No. of wins, z-score= .949 pvalue= .82864 Analysis of Throws-per-Game: Chisq= 20.19 for 20 degrees of freedom, p= .55382 Throws Observed Expected Chisq Sum 1 66478 66666.7 .534 .534 2 37973 37654.3 2.697 3.231 3 26936 26954.7 .013 3.244 4 19347 19313.5 .058 3.302 5 13745 13851.4 .818 4.120 6 9827 9943.5 1.366 5.486 7 7157 7145.0 .020 5.506 8 5136 5139.1 .002 5.508 9 3695 3699.9 .006 5.514 10 2603 2666.3 1.503 7.017 11 1921 1923.3 .003 7.020 12 1456 1388.7 3.258 10.277 13 1036 1003.7 1.038 11.316 14 719 726.1 .070 11.386 15 571 525.8 3.879 15.265 16 376 381.2 .070 15.335 17 257 276.5 1.381 16.715 18 189 200.8 .697 17.412 19 156 146.0 .687 18.099 20 114 106.2 .571 18.670 21 308 287.1 1.519 20.189 SUMMARY FOR block6.rng p-value for no. of wins: .828643 p-value for throws/game: .553823 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Results of DIEHARD battery of tests sent to file report6.txt