Using the Linear Congruential Generator (LCG) with a=67, m=31, c=17 and seed Z0 = 117generate the first FIVE random variates on [0,1]. (6 Marks)
Question
Using the Linear Congruential Generator (LCG) with a=67, m=31, c=17 and seed Z0 = 117 generate the first FIVE random variates on [0,1]. (6 Marks)
Solution
The Linear Congruential Generator (LCG) is a type of pseudorandom number generator. It is defined by the recurrence relation:
Zn+1 = (a*Zn + c) mod m
where:
- Zn is the sequence of pseudorandom values
- a, c, and m are generator-specific constants
- "mod" is the modulus operator
In this case, a=67, c=17, m=31, and the seed Z0=117.
Let's generate the first five random variates:
- Calculate Z1: Z1 = (aZ0 + c) mod m = (67117 + 17) mod 31 = 29
- Calculate Z2: Z2 = (aZ1 + c) mod m = (6729 + 17) mod 31 = 14
- Calculate Z3: Z3 = (aZ2 + c) mod m = (6714 + 17) mod 31 = 6
- Calculate Z4: Z4 = (aZ3 + c) mod m = (676 + 17) mod 31 = 27
- Calculate Z5: Z5 = (aZ4 + c) mod m = (6727 + 17) mod 31 = 23
Now, to convert these to the range [0,1], divide each by m:
- Z1/m = 29/31 = 0.9355
- Z2/m = 14/31 = 0.4516
- Z3/m = 6/31 = 0.1935
- Z4/m = 27/31 = 0.8710
- Z5/m = 23/31 = 0.7419
So, the first five random variates on [0,1] are 0.9355, 0.4516, 0.1935, 0.8710, and 0.7419.
Similar Questions
Which of the following options is the best for generating random integer 0 or 1?
or a standard normal distribution, the probability of z <= 0 isGroup of answer choiceszero1-.5.5
The value of the normal distribution at Z is 0.8770. The value of Z is _______.Question 10Select one:a.1.16b.0.18c.0.81d.1.47
For a standard normal distribution, the probability of obtaining a z value between -1.9 to 1.7 isQuestion 3Select one:a.0.9267b.1.254c.0.4267d.1.42670.5000
Suppose Z follows the standard normal distribution. Use your z table, to determine the value of c so that the following is true.2 points0.10.30.50.7
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.