The pairs frequency test looks for correlation between successive values in the sequence produced by random(). Generate 2N values and divide the sequence into N pairs. These pairs, when considered as coordinates in 2-space, should be uniformly distributed over a square (2**31) on a side. Divide this square into (m**2) sub-squares by partitioning the ranges (0,(2**31)-1) of each number in the pair into m equal-size intervals. Count the number of pairs (coordinates) that fall in each sub-square. There should be about N/(m**2) in each. Calculate the chi-square statistic based on the actual and expected counts for each sub-square, and compare with the critical value for a chi-square random variable with (m**2)-1 degrees of freedom and a probability of 0.95.
For the pairs tests reported here, the values used were m = 10 and N = 1,000,000 (100 sub-squares and 5,000 pairs expected in each sub-square).
Return to the testing home page.