For this assignment, you will design and implement a pseudorandom number generator class. Your class should implement the RandI interface (provided on Eureka).
Computers cannot generate ‘truly’ random numbers. Instead, they compute ‘pseudo-random’ numbers that appear to be random but which are generated deterministically. The basic approach is the linear congruence method. The sequence generated is dependent upon a seed, a multiplier, an increment, and a modulus. The formula for generating the next pseudorandom number in the sequence is:
(multiplier * seed + increment) % modulus(You can look up the Java % operator to see what it does, though you may be able to guess from the name of its second operand.)
The seed is initially set by one of several schemes
such as sampling the current time of day;
for our purposes, it will be an input to the constructor.
After the first pseudorandom number has been generated,
the seed is always set to the most recently generated number.
For example: with multiplier, increment and modulus values of 40, 3641 and 729 respectively,
and an initial seed of 1, our first pseudorandom number would be:
(40 * 1 + 3641) % 729 = 36and after accessing this first random number, the seed value will be 36. When asked for the next pseudo-random number, this generator would compute
(40 * 36 + 3641) % 729 = 707with the seed having a new value of 707. And so on.
Design and implement a class, PRNG, that generates a sequence of (pseudo) random numbers in the manner just described. As mentioned above, we want your class to implement the RandI interface.
As always, you should fully document your code using javadoc directives. Similarly, you should generate the html files resulting from those comments and inspect them for completeness and correctness. Include these html files in your final submission.
Important: you should be using the default package. When bundling your files for submission, make sure that you create a folder named with your Westmont email name followed by ‘Ex2’. For example, someone with email address ‘cjones’ would create a folder called ‘cjonesEx2’. Make sure that inside that folder you have: java source files as well as html documentation files resulting from javadoc; you will also need to include the resources folder, stylesheet.css, and any other html files. Finally, either tar or zip the folder so that when we extract it, the folder “<emailname>Ex2” will be created (with your actual eamil name). Submit the resulting archive on Eureka.