Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Your program will demonstrate that random number generator functions, will generate uniformly distributed random numbers. What that means is: as you randomly select numbers -
Your program will demonstrate that random number generator functions, will generate uniformly distributed random numbers. What that means is: as you randomly select numbers - by calling the function get_random_number) - if you count how many times you get a 1, and how many times you get a 3,..., and how many times you geta 9; the counts for each integer should be approximately the same. If the integers 0 through 9 were normally distributed (i.e the bell curve, also called a Gaussian Distribution), then the count for integer 5, would be much larger than the count for 1 or 8. There is an array of ints called "counts" (i.e. counts[100). The "counts" array will hold the number of times each integer from 0 to 9 is generated. So counts[0] will hold the number of times "O" randomly comes up, and counts[1] will hold the number of times "1" randomly comes up, etc. You need to write the function called: "accumulate_counts_per_integer". The prototype for this function is shown below. void accumulate counts per integer( int , int This function will take two arguments: the "counts" array, and also the number of times to call the random number generator (i.e. "sample_size" ). Each time you call the get_random_number() function, you'll need to increment the count for the integer that is return (e.g. if 4 is returned, then you'll need to add 1 to the count stored in counts[4]). The overall structure of the program and some of the code is provided on the next page. Remember, you only need to write the code for: void accumulate_counts_per_integer( int [] int
Step 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