Pseudo-random numbers Randomly generating numbers is a crucial subroutine of many algorithms in computer sci- ence. Because computers execute deterministic code, it is not possible (without external influence) to generate truly random numbers. Hence, computers actually generate psuedo- random numbers. The linear congruential method is a simple method for generating pseudo-random numbers. Let m be a positive integer and a be an integer 2 < a
Pseudo-random numbers
Randomly generating numbers is a crucial subroutine of many
The linear congruential method is a simple method for generating pseudo-random numbers. Let m be a positive integer and a be an integer 2 < a <m, and c be an integer 0 ≤ c<m. A linear congruential method uses the following recurrence relation to define a sequence of pseudo-random numbers:
In+1=a+c mod m
(a) Use the linear congruence method with a = 8, c=5, and m = 14, to compute the first 15 pseudo-random numbers when co= 1. That is, compute zo,X1, X 14-
(b) From part (a) we should notice that, with m = 14, the sequence does not contain all 14 numbers in the set Z14. In particular because the sequence is periodic. Using m = 8, determine the value of a which does give all 8 possible numbers before repeating. For your choice of a, which choices of c give all 8 possible numbers? For each a, c pair which give all 8 possible numbers, give the terms of the sequence To...., 7 with 16 = 1
(c) When c = 0, a linear congruence generator is called a purely multiplicative generator. Consider the generator defined by:
Fn+1=65539 mod 231
Show that, modulo 231, this purely multiplicative generator is equivalent to the recurrence relation:
Hint: 65539 216 +3 =
Step by step
Solved in 4 steps