Question: Task 2: Choose parameter values for the LCG The period of a pseudorandom number generator is the number of unique values that the generator produces


Task 2: Choose parameter values for the LCG The period of a pseudorandom number generator is the number of unique values that the generator produces before repeating. Because of the way that an LCG works-\"modding" each result by the constant m-its maximum period is m. If an LCG actually has a period of m, it is said to have full period. It turns out that an LCG will have full period if the following three condition are met: 1. The constants c and m are relatively prime-Le, they have no common divisors other than 1. 2. (a - 1) is divisible by all prime factors of m. Note that we said all prime factors; it does not need to be divisible by all factors of m. 3. If m is divisible by 4, then (a - 1) must also be divisible by 4. Your task: Assume that you are constructing an LCG in which m is 100. Find the smallest values of a and c that can be used with this value of m to produce an LCG with full period. You should determine these values \"by hand.\" In addition to satisfying the requirements above, both the multiplier a and the increment c should be greater than 1. The Math Behind Pseudorandom Number Generators A linear congruential generator (LCG) is an algorithm that generates a sequence of integers that "look and feel\" like random numbers. The numbers generated are not truly random because they're generated by a mathematical formula, but they have statistical properties that make them behave like true random numbers. Hence they are referred to as pseudorandom numbers. The LCG algorithm is dened by the recurrence relation: xi+1 = (am + c) 96 m where: - m is a positive divisor I a is a multiplier greater than 1 - c is a positive increment In addition, the algorithm needs a "seed value" x0 that is between 0 and m-1. All four of these values are integers. Given these values, an LCG random-number generator: - uses the above formula to compute x1 from x0 - uses the same formula to compute x2 from x1 - uses the same formula to compute X3 from x2 and so on-until we have enough pseudorandom numbers for our needs. Note that the numbers generated in this way are always between 0 and m-1 because we are \"modding" our numbers by m
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
