Question: A simple random generator is obtained by the formula r new = (a . r old + b)%m and then setting r old to r

A simple random generator is obtained by the formula rnew = (a . rold + b)%m

and then setting rold to rnew. If m is chosen as 232, then you can compute rnew = a . rold + b

because the truncation of an overflowing result to the int type is equivalent to computing the remainder. Write a program that asks the user to enter a seed value for rold. (Such a value is often called a seed). Then print the first 100 random integers generated by this formula, using a = 32310901 and b = 1729.

Step by Step Solution

3.34 Rating (157 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

ANSWER include include inclu... View full answer

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 Java Concepts Late Objects Questions!