A simple random generator is obtained by the formula r new = (a . r old +

Question:

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.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: