Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Pseudorandom.java Chapter 2 readings ( programing projects ) Pago 1 1 0 - ZOOM + Part 2: Generating a series of random numbers can be

Pseudorandom.java

image text in transcribed

image text in transcribed

Chapter 2 readings ( programing projects )

image text in transcribed

image text in transcribed

Pago 1 1 0 - ZOOM + Part 2: Generating a series of random numbers can be achieved in Java by using the java.util. Random class. However, the numbers gcalcuated are not truly randon, they are pseudorandom. That is, they are produced by algorithms that generate a fixed but random-looking sequence of numbers. In this assignment you will leam the basic ideas behind generating pseudorandom numbers and implement your own pseudorandom mauber generator. Knowing low pseudorandom numbers are generated and their limitations may help you in the future when you use pseudorandom numbers in simulations and other applications, Do programang projects 11, 12, and 13 ou pyes 99-100 of the textbook. In project 13 you are asked to experiment with different values of the multiplier increment, and modulus. Find your own values of constants (different from the ones in the book) that are good (which result in about 10% of the numbers in cach interval). Also, lund values of multiplier, increment, and modulus tant are not good (which result in some intervals having na munbers). Use Eclipse to create a new project with the name, say. Lab2. In the project create three new classes as described below. Your implementation should include the following 3 classes 1) Pseudorandom.java - implements a class that generates pseudorando embers. You must use the principle of information hiding in your implementation (instance variables must be private). Instance variables of the Pseudorandom class should be multiplier, increment, modulus, and seed (of type int) You need to implement the following methods that are described in the projects 11 and 12): Constructor with initial seed, multiplier, increment, and modulus as parameters, changeSeedownew_seed), netini() that generales and routs a pseudorandon integer number nextDouble() that generates and returns a pseudorandom double munber in the range [0..1) (project 12 from the textbook). Note that modidus must not be cqual to 0 in order for next nextDouble methods to work. 2) TestPseudorandom.java - tests Pseudorandom class. It should prompt the user to enter initial values for seed, multiplier, increnent, and modulus, and include test calls to all of the constructors and methods 3) Test Distribution.java - determines distribution of numbers (project 13 from the textbook). It should prompt the user to enter initial values for seed, multiplier, increment, and mochilus, and output a table with numbers of occurences for each range. Use your Test Distribution class from project 13 to experiment with different values of the multiplier, increment, and modulus. Prepare a text file (*.txt file) which contains good values of the multiplier, increment, and modulus that you found should be different from the values provided in the textbook), together with the output of your TestDistribution program when run with these numbers, and Page of 2 0 - ZOOM + not good values of the multiplier, increment, and modulus that you found, together with the output of your Test Distribution program when run with these numbers. Mark which values are good and which are not good in the text file. Specifications for all your methods should be included as coruncats in your code. Method specifications should follow the guidelines from Section 1.1 pp. 7-8), that is, include a short introduction, parameter description. preconditions (if any), postcondition or returns condition, the tiurows list (if any). Also, please use inline continents, meaningful variable rates, indentation, formatting and whitespace throughout your program to improve its readability. Tips for naming variables Thoroughly test your cade. What to submit: 1. Submit your answers to the Running Time worksheet. You may print Running Time worksheet answers in the dock file, save it in cand submit as a pdf tile. Alternatively, you may write you 2. Submit your source code (java files) electronically on Canvas 3. Subunit a text file (*.txt file) which contains good and not good values of the multiplies, increment, and modulus that you found, together with the output of your Test Distribution program when nu with these numbers Page

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

Step: 3

blur-text-image

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

Data Science For Dummies

Authors: Lillian Pierson ,Jake Porway

2nd Edition

1119327636, 978-1119327639

More Books

Students also viewed these Databases questions

Question

Develop successful mentoring programs. page 400

Answered: 1 week ago