Simulation and Modelling - Old Questions
8. Use mixed congruential method to generate a sequence of random numbers with X0 = 27, a = 17, m = 100 and c = 43.
Given,
X0 = 27,
α = 17,
c= 43 &
m=100
We have,
Xi+1 = (α Xi + c) mod m
Mixed Congruential Method: c ≠ 0
& Ri =Xi/m,
The sequence of random numbers are calculated as follows:
X0 = 27
R0 = 27/100 = 0.27
X1 = (α X0 + c) mod m = (17*27+43) mod 100 = 502 mod 100 = 2
R1 = 2/100 = 0.02
X2 = (α X1 + c) mod m = (17*2+43) mod 100 = 77 mod 100 = 77
R2 = 77/100 = 0.77
X3 = (α X2 + c) mod m = (17*77+43) mod 100 = 1352 mod 100 = 52
R3 = 52/100 = 0.52
X4 = (α X3 + c) mod m = (17*52+43) mod 100 = 927 mod 100 = 27
R4 = 27/100 = 0.27
Therefore,
The sequence of random integers are 27, 02, 77, 52, 27 & so on.
The sequence of random numbers are 0.27, 0.02, 0.77, 0.52, 0.27 & so on.