Question: Recall that a way of simulating a sequence x 1 , x 2 , . . . pseudorandom numbers is via a linear congruential generator

Recall that a way of simulating a sequence x1, x2,... pseudorandom numbers
is via a linear congruential generator (LCG),
xj+1= axj + b mod m.(1)
(a)(6 marks) Write a function with inputs n, a, b, m, s to produce a sequence of n (i.e. list/array of length n) pseudorandom numbers according
to (1) with seed s (i.e. x0= s).
(b)(2 marks) Demonstrate your function works by creating a list of 20
pseudorandom numbers with a =51 and b =13, m =2^8+1, s =7.
(c)(2 marks) Why would the choice of parameters a =2, b =4, m =8 be
a bad choice for creating pseudorandom numbers?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!