Question: Write a class RandomPlayer which performs some tests using a Random object. RandomPlayer has this constructor: public RandomPlayer(Random generator, int upperBound, int numberOfIterations) where generator

Write a class RandomPlayer which performs some tests using a Random object.

RandomPlayer has this constructor:

public RandomPlayer(Random generator, int upperBound, int numberOfIterations) where

generator is the Random object

upperBound is the maximum value of the generated numbers. If upperBound is 50, then generate random ints greater than or equal to 0 and less than 50 in the methods.

numberOfIterations is the number of random ints to generate (the number of times to run your loop).

It has these methods

public double average() - generates the specified number of random ints and gets the average of the values generarated.

public int countGreaterThanMidValue() - generates the specified number of random ints and counts how many are greater than the upperBound / 2. You would expect it to be about half the time, but is it? Do not calculate the average in this method call average()

public int count(int value) - generates the specified number of random ints and gets the number of times the value appears

public void setIterations( int numberOfIterations)sets the number of iterations for this object

Provide Javadoc

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!