Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java 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
Java
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) = [U(0, 1) (b a +1)] +a where a and b are integers, a 5 b, ) 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). 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) = [U(0, 1) (b a +1)] +a where a and b are integers, a 5 b, ) 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). 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 labelStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started