Problem

Write a utility class called RandomDistribution, which contains the following four class m...

Write a utility class called

RandomDistribution,
which contains the following four class methods. You should be able to implement all of these methods with calls to Math class methods and/or calls to one of the
uniform
methods within the
RandomDistribution
class.

a) Write a method called

uniform
that generates a
double
random number from a continuous distribution that is uniform between
double
values
min
and
max.


b) Write another (overloaded) method called

uniform
that generates an
int
random number from a discrete distribution that is uniform between
int
values
min
and
max,
including both of these end points.


c) Write a method called

triangular
that generates an
int
random number from a symmetrical discrete triangular distribution that goes between
int
values
min
and
max,
including both of these end points. (Hint: Make two calls to the
int
version of the above
uniform
method.)


d) Write a method called

exponential
that generates a
double
random number from an exponential distribution having an expected time between random arrival events equal to
averageTimeInterval.
Here is the algorithm:

return ← averageTimeInterval * loge(1.0 – Math.random)

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT