Description 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: Sample Run H68 SAWNH ----jGRASP exec: java Odds Value Count One Asterisk equals 1000 7 main() - contains the basic program and control. 9 displayData - accepts the array as an argument and builds the output as shown in the sample run. 10 |10217 | 10078 19948 | 10018 9818 9812 9997 10048 |10021 | 10042 |* ----jGRASP: operation complete.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a program in Java for the following

 

 

 

Description
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:
Sample Run
4
----jGRASP exec: java Odds
Value Count One Asterisk equals 1000
1 |10217
2
| 10078
9948
| 10018
L6849 SAWN
3
main() - contains the basic program and control.
display Data - accepts the array as an argument and builds the output as shown in
the sample run.
4
5
9818
9812
9997
10048
| 10021
10 |10042
----jGRASP: operation complete.
7
Transcribed Image Text:Description 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: Sample Run 4 ----jGRASP exec: java Odds Value Count One Asterisk equals 1000 1 |10217 2 | 10078 9948 | 10018 L6849 SAWN 3 main() - contains the basic program and control. display Data - accepts the array as an argument and builds the output as shown in the sample run. 4 5 9818 9812 9997 10048 | 10021 10 |10042 ----jGRASP: operation complete. 7
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education