Next: A test on Up: The generator and Previous: The linear congruential

## Tests on the random number stream

We wrote the following tests for the random number stream :

• the Uniformity Test. The interval is split up into 10 intervals. For randomness we would expect the counts in each interval to be equal. A test is performed with each member of the expected array equal to the number of random fractions divided by 10.

We also wrote two variations of this test. The first one groups the random numbers into pairs, the second one into triples. The expected values of each pair and triple are then the number of random fractions divided by 2*100 and by 3*125 (5 intervals) respectively.

• The Poker Test. In this test we multiply the random fractions with 10 and cast them to integers. Furthermore we group the sequence of integers into sequences of five consecutive integers. The frequency of the following categories is recorded :
• 1 - All of the same or two different integers in a group.
• 2 - Three different integers in a group.
• 3 - Four different integers in a group.
• 4 - Five different integers in a group.
A test is performed with the following expected values for each category (n is the number of fractions):
• 1 - 0.0136 n.
• 2 - 0.1800 n.
• 3 - 0.5040 n.
• 4 - 0.3024 n.
• the Gap Test. An interval between a and b is defined . Each random number is replaced with 0 if outside and with 1 if inside the interval. We are interested in the lengths of the gaps. The expected value of a gap of length k is :

• the Coupon Collector Test. In this test we divide the interval [0,1) into five intervals [0,0.2),..,[0.8,1). The number of random fractions to get at least a count of 1 in each interval is counted. We define 16 categories as follows :
• 1 - sequence of 5.
• 2 - sequence of 6.
• ..
• 15 - sequence of 19.
• 16 - sequence of 20 or more.
The expected values of each category are calculated as :

with n the number of fractions and from the following sequence of probabilities : 0.03840000, 0.07680000, 0.09984000, 0.10752000, 0.10450944, 0.09547776, 0.083816 45, 0.07163904, 0.06011299, 0.04979157, 0.04086200, 0.03331007, 0.02702163, 0.02 184196, 0.01760857, 0.07144851

In all cases we fill an array with the expected values for the taken test and perform a test with the observed values with the method from the analysis class. The hypothesis of randomness is rejected if the probability is less then 0.05 (no randomness) or more then 0.95 (fabricated) in 95% or more of the experiments.

Next: A test on Up: The generator and Previous: The linear congruential

A Eliens
Tue Oct 31 09:27:21 MET 1995