Question
Write a C++ program that generates one million random real numbers chosen from a normal distribution with mean and standard deviation . The quantity should
Write a C++ program that generates one million random real numbers chosen from a normal distribution with mean and standard deviation . The quantity should be chosen as a random number taken from a uniform distribution on the interval [10, 10], and should be chosen as 1. Use the random-number-generation engine std::mt19937 (i.e., 32-bit Mersenne Twister) seeded with a random number from std::random_device. Output a (text-based) histogram with 20 bins to show the approximate distribution. The histogram output should follow the formatting example shown below. The output has one line per histogram bin, consisting of two fields: 1) a real number specifying the center of the histogram bin; and 2) zero or more asterisks, with number of asterisks chosen in proportion to the histogram bin count. Avoid having a single line of output exceed 80 characters so that the histogram will display without line wrapping on an 80-column terminal. -11.07 -10.60 -10.13 -9.66 -9.19 * -8.73 ****
-8.26 ********** -7.79 ******************* -7.32 ***************************** -6.85 ************************************ -6.38 *********************************** -5.91 **************************** -5.44 ****************** -4.97 ********* -4.50 *** -4.04 * -3.57 -3.10 -2.63 -2.16
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