For each pair of successive random numbers (q, r), 0 <= q, r <= d, count the number of times that (q, r) occurs and conducts a Chi-square goodness-of-fit test. d is now chosen as 2n (n is the number of bits for the generator, maximum 12 bits) and sample size is 5 * 2 * 2n. This program can be extended to triples and quadruples instead of pairs. The function returns a uniform random no. in [0,1]. The test is failed if the value less than 0.001 or larger than 0.999.