in C++ generate a histogramLinks to an external site. of 20,000 randomly generated integer numbers according to a normal distribution with a user-specified mean and standard deviation. Your histogram will include the frequencies of at least 9 data points centering at the mean value: mean +/- x*stdDev, where x is in {0, 1, 2, 3, 4}. For example, given mean=1 and standard deviation of 2, you will calculate the frequency of at least the following values: 1-4*2, 1-3*2, 1-2*2, 1-2, 1, 1+2, 1+2*2, 1+3*2, 1*4*2.
in C++
generate a histogramLinks to an external site. of 20,000 randomly generated integer numbers according to a normal distribution with a user-specified mean and standard deviation. Your histogram will include the frequencies of at least 9 data points centering at the mean value: mean +/- x*stdDev, where x is in {0, 1, 2, 3, 4}. For example, given mean=1 and standard deviation of 2, you will calculate the frequency of at least the following values: 1-4*2, 1-3*2, 1-2*2, 1-2, 1, 1+2, 1+2*2, 1+3*2, 1*4*2.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
Generate a histogram of 20,000 randomly generated floating-point numbers according to a uniform distribution with a user-specified range [a, b], where a and b are parameters. The histogram will include the frequencies of numBins (>=21) values equal-width data bins that are equally evenly distributed between a and b. For instance, if a=2.0, b=10.0, you will calculate the frequencies total number of randomly generated values that fall into each of following data bins, where each bin has a width of (b-a)/21 and centers at 2.0, 2.0+(8.0/20)*1, 2.0+(8.0/20)*2, 2.0+(8.0/20)*3, ..., 2.0+(8.0/20)*20=10, respectively. To keep it simple, your can set the precision of each center at 0.1 (i.e., only consider the first digit after the decimal point, e.g., 2.0, 2.4, 2.8, etc.). Put all the above together, if the randomly generated value is 2.44323, it falls into the bin centering at 2.4 since rounding 2.44323 with a precision of 0.1 is 2.4.