Consider a linear congruential
- Consider a linear congruential random number generator withparameters a = 3,
m = 16, and c=0.
- Select the seed X0 = 3, and generate 3 random variables usingthis generator.
- What is the period of this generator?
From given data,
Consider alinear congruential random number generator with parameters a = 3,m= 16, and c=0.
a = 3,
m = 16,
The recurrence relation to define generator is
Xn+1 = (a Xn+c) mod m
here X is sequence of random numbers
and X0 is referred to seed which is also called startvalue.
Select the seedX0 = 3, and generate 3 random variables using thisgenerator.
No we have X0 = 3, we need to generate three randomnumbers with it
as we are starting with n = 0 (X0)
X1 = (a*X0 + c ) mod m
X1 = (3*3 + 0) mod 16
X1 = 9 mod 16
X1 = 9
Now let us try X2
X2 = (a * X1 + 0) mod 16
X2 = (3*9 + 0) mod 16
X2 = 27 mod 16
X2 = 11
X3 = (a * X2 + 0) mod 16
X3 = (3* 11 + 0) mod 16
X3 = 33 mod 16
X3 = 1
What is theperiod of this generator
Period of Generator :
When c = 0 then generator is call multiplicative congruentialgenerator and period of MCG is at most m