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
uniformmethods within the
RandomDistributionclass.
a) Write a method called
uniformthat generates a
doublerandom number from a continuous distribution that is uniform between
doublevalues
minand
max.
b) Write another (overloaded) method called
uniformthat generates an
intrandom number from a discrete distribution that is uniform between
intvalues
minand
max,including both of these end points.
c) Write a method called
triangularthat generates an
intrandom number from a symmetrical discrete triangular distribution that goes between
intvalues
minand
max,including both of these end points. (Hint: Make two calls to the
intversion of the above
uniformmethod.)
d) Write a method called
exponentialthat generates a
doublerandom 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)
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.