Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

lcg(a,b,m,R0) uses this formula: Ri+1 = (aRi + b) (mod m) i 0 we need to answer these two questions based on that formula: I

lcg(a,b,m,R0) uses this formula:

Ri+1 = (aRi + b) (mod m) i 0

we need to answer these two questions based on that formula:

image text in transcribed

I just need the formula to get a and b from two equations of the form:

R1 = (a R0 + b) mod m

R2 = (a R1 + b) mod m if I know R0, R1, R2 and m I need to be able to find a and b

Problem 3 Short answer: An LCG with 16 generates the numbers R 2, R2 11, and Rs 8. Determine the values of a, b, and R. Include your solution, including all relevant work and explanation, in your a3.pdf. Problem 4 In problem 3, you were able to "hack" an LCG by obtaining the values of a and b and thus predict all of its future output (you predicted R4, but of coursc, since a and b are fixed, you could predict any quantity of future valucs). In this problem, you will automate this process. Write a module "a3p4." containing a function "crack-leg(m. ri, r2, r3)", where m is a positive integer, and rl, r2, and r3 are integers between 0 and m -1, inclusive. This function should return a list [a,b], where a and b are the keys for an LCG, with modulus m, which outputs r1, r2, and r3 as its first three random numbers (i.e. rl- Ri, r2- R2, and r3R) Note that in some cases, there may not be a solution. In that case, output the list (0,0] (ie, report a =-0). your program should Problem 3 Short answer: An LCG with 16 generates the numbers R 2, R2 11, and Rs 8. Determine the values of a, b, and R. Include your solution, including all relevant work and explanation, in your a3.pdf. Problem 4 In problem 3, you were able to "hack" an LCG by obtaining the values of a and b and thus predict all of its future output (you predicted R4, but of coursc, since a and b are fixed, you could predict any quantity of future valucs). In this problem, you will automate this process. Write a module "a3p4." containing a function "crack-leg(m. ri, r2, r3)", where m is a positive integer, and rl, r2, and r3 are integers between 0 and m -1, inclusive. This function should return a list [a,b], where a and b are the keys for an LCG, with modulus m, which outputs r1, r2, and r3 as its first three random numbers (i.e. rl- Ri, r2- R2, and r3R) Note that in some cases, there may not be a solution. In that case, output the list (0,0] (ie, report a =-0). your program should

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What are the role of supervisors ?

Answered: 1 week ago

Question

1. What are your creative strengths?

Answered: 1 week ago

Question

What metaphors might describe how we work together?

Answered: 1 week ago