here are random number tests in fips 140 http://www.nist.gov/itl/lab/fips/fip140-1.txt Statistical random number generator tests. Cryptographic modules that implement a random or pseudorandom number generator shall incorporate the capability to perform statistical tests for randomness. For Levels 1 and 2, the tests are not required. For Level 3, the tests shall be callable upon demand. For level 4, the tests shall be performed at power-up and shall also be callable upon demand. The tests specified below are recommended. However, alternative tests which provide equivalent or superior randomness checking may be substituted. A single bit stream of 20,000 consecutive bits of output from the generator is subjected to each of the following tests. If any of the tests fail, then the module shall enter an error state. The Monobit Test 1. Count the number of ones in the 20,000 bit stream. Denote this quantity by X. 2. The test is passed if 9,654 < X < 10,346. The Poker Test 1. Divide the 20,000 bit stream into 5,000 contiguous 4 bit segments. Count and store the number of occurrences of each of the 16 possible 4 bit values. Denote f(i) as the number of each 4 bit value i where 0 ó i ó 15. 2. Evaluate the following: X = (16/5000) * [SUM of f(i)^2, for i = 0 to 15] - 5000 3. The test is passed if 1.03 < X < 57.4. The Runs Test 1. A run is defined as a maximal sequence of consecutive bits of either all ones or all zeros, which is part of the 20,000 bit sample stream. The incidences of runs (for both consecutive zeros and consecutive ones) of all lengths (ò 1) in the sample stream should be counted and stored. 2. The test is passed if the number of runs that occur (of lengths 1 through 6) is each within the corresponding interval specified below. This must hold for both the zeros and ones; that is, all 12 counts must lie in the specified interval. For the purpose of this test, runs of greater than 6 are considered to be of length 6. Length of Run Required Interval 1 2,267 - 2,733 2 1,079 - 1,421 3 502 - 748 4 223 - 402 5 90 - 223 6+ 90 - 223 The Long Run Test 1. A long run is defined to be a run of length 34 or more (of either zeros or ones). 2. On the sample of 20,000 bits, the test is passed if there are NO long runs.