next up previous
Next: Frequency test Up: Random-Number Generation Previous: Combined Linear Congruential Generators

Tests for Random Numbers

When a random number generator is devised, one needs to test its property. The two properties we are concerned most are uniformity and independence. A list of tests will be discussed. The first one tests for uniformity and the second to fifth ones test independence.

  1. Frequency test
  2. Runs test
  3. Autocorrelation test
  4. Gap test
  5. Poker test

The algorithms of testing a random number generator are based on some statistics theory, i.e. testing the hypotheses. The basic ideas are the following, using testing of uniformity as an example.

We have two hypotheses, one says the random number generator is indeed uniformly distributed. We call this $H_0$, known in statistics as null hypothesis. The other hypothesis says the random number generator is not uniformly distributed. We call this $H_1$, known in statistics as alternative hypothesis.

We are interested in testing result of $H_0$, reject it, or fail to reject it.

To see why we don't say accept H null, let's ask this question: what does it mean if we had said accepting H null? That would have meant the distribution is truely uniform. But this is impossible to state, without exhaustive test of a real random generator with infinite number of cases. So we can only say failure to reject H null, which means no evidence of non-uniformity has been detected on the basis of the test. This can be described by the saying ``so far so good''.

On the other hand, if we have found evidence that the random number generator is not uniform, we can simply say reject H null.

It is always possible that the $H_0$ is true, but we rejected it because a sample landed in the $H_1$ region, leading us to reject $H_0$. This is known as Type I error. Similarily if $H_0$ is false, but we didn't reject it, this also results in an error, known as Type II error.

With these information, how do we state the result of a test? (How to perform the test will be the subject of next a few sections)

For a given set of random numbers produced by a random number generator, the more tests are, the more accurate the results will be.



Subsections
next up previous
Next: Frequency test Up: Random-Number Generation Previous: Combined Linear Congruential Generators
Meng Xiannong 2002-10-18