## Example 1 LCG (5, 1, 16, 1)     continued...

• This particular sequence exhibits throughout its period the pattern of alternating odd and even integers. It is frequently instructive to view this sequence in binary and then after performing a real division by m to result in random real numbers (see Table 1). It is readily apparent that the sequence is serially correlated. In fact, note that the right-most binary digit exhibits the regular pattern . Due to this lack of randomness, the values should not be used as random digits (especially the right-most digits of ). In fact, this lack of randomness results from using a power of two for m. Despite this, a modulus which is a power of two is often used, for this renders the process of performing the modulus operation very efficient. Moreover, the real numbers generated from the integer sequence are generally sufficiently random in the higher order (most significant) bits to be used in many application codes.

• Next, we infer the following. Because each random integer results from the previous integer alone, selecting any initial seed from 0 to 15 would just cyclically shift the above sequence. We could begin anywhere on the random number cycle, and we would proceed clockwise around the random number cycle from that starting point. Thus, all that a different choice of the initial seed does is shift the starting point in the sequence already determined by a, c and m.

• Finally, we note that the average of the real numbers is 0.4688 and the variance is 0.0830. The departure of these values from the ideal ones of 1/2 and is due to the short period of this sequence and the rather coarse resolution of the generated real numbers. These conditions of average and variance approaching the theoretical values are necessary but not sufficient conditions for a good random number generator.

Let us exercise the code ranlc.f for additional parameters. In so doing, we shall choose parameters that illustrate specific aspects of linear, congruential generators. First, we take the case of c = 0. This is termed a multiplicative congruential random number generator:

The case is termed a mixed congruential random number generator.