There are some other interesting observations of LCGs which have the power of a prime as their modulus. In the sequence of the above LCG, notice the differences between adjacent elements in the same column. This formula can be used to calculate the difference between x q and any element n places ahead. The difference between any two elements adjacent in the same column will be congruent to 10, modulo 25. One way to avoid, or at least hide, these orderly tendencies, is to combine the sequences of two, or more LCGs.
Addition is used here for simple demonstration.
If the moduli of the individual LCGs are relatively prime, then the period of the combined sequence will the product of the respective moduli. This file combines the two LCGs in this article, and contains the functions necessary to implement them. The combined sequence is in listing 2 . The actual current values of the LCGs are stored as static globals. There are legitimate uses for global variables, and I believe this is one such case.