Create a class named H3_Q2.java to accomplish the following tasks. a. Add a loop that generates 10,000 discrete random numbers betweewn a = 10 and b = 100. The formula for generating a discrete uniform random number is DU(a, b) = bU(0, 1) × (b − a + 1)c + a where a and b are integers, a ≤ b, b c is the floor operator and U(0, 1) is a uniform random variable between 0 and 1 (hint: we generated U(0, 1) values in class). 1 b. For the 10,000 random numbers generated in a., add code that counts the total number of times that the random value generated is in either of the following ranges: [0,2] or [16,44]. Print this total to the screen with an appropriate label. c. Write a loop the continues to generate random floating-point numbers between 0 an 1 until the random value generated exceeds 0.9. Write every value generated to an output file named Q2cOutput.txt located in a directory named output_files. Print out the number of times the loop was executed to the same file with an appropriate label.
Create a class named H3_Q2.java to accomplish the following tasks.
a. Add a loop that generates 10,000 discrete random numbers betweewn a = 10 and b = 100. The formula
for generating a discrete uniform random number is
DU(a, b) = bU(0, 1) × (b − a + 1)c + a
where a and b are integers, a ≤ b, b c is the floor operator and U(0, 1) is a uniform random variable
between 0 and 1 (hint: we generated U(0, 1) values in class).
1
b. For the 10,000 random numbers generated in a., add code that counts the total number of times that
the random value generated is in either of the following ranges: [0,2] or [16,44]. Print this total to the
screen with an appropriate label.
c. Write a loop the continues to generate random floating-point numbers between 0 an 1 until the random
value generated exceeds 0.9. Write every value generated to an output file named Q2cOutput.txt
located in a directory named output_files. Print out the number of times the loop was executed to
the same file with an appropriate label.

Trending now
This is a popular solution!
Step by step
Solved in 2 steps









