Question: Write a program in Java for the following One way of testing a random generator is to test the distribution. In an infinite set of

Write a program in Java for the following

Write a program in Java for the following One way of testing

One way of testing a random generator is to test the distribution. In an infinite set of values, every value should be evenly generated. For this example, we'll also calculate the difference between each values percentage. Design and write a Java program that counts the number of values the random generator creates over 100,000 cycles. Set random to return an integer value from 1 to 10 . Create a one-dimensional array to store the count of each randomly generated value. This can be done by adding one (1) to the data stored in the appropriate index, which represents the random value. For example, when the number one (1) is generated, add one (1) to the value in arrayName[1]. When the number two (2) is randomly generated, add one (1) to the value in arrayName[2] and so on. We will ignore arrayName[0], because it is not part of our random numbers. We will also draw a histogram of the results. In the sample run, each asterisk * represents a 1,000 . So, a value of 10,000 would print out 10 asterisks. (We cannot draw a fraction of an asterisk!) The columns in the output must align. You must use the following methods: main () - contains the basic program and control. displayData - accepts the array as an argument and builds the output as shown in

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!