I finished 1 and part of two but I mostly need help on completing 3-Collecting the distribution and 4-Bar Graph.
Using-
double rx_normal(double mean, double dev); // return a random double following a normal distribution
#define TICKS // the number of intervals in a unit #define NBIN (UPPER LIMIT-(LOWER LIMIT)) TICKS) int bin[NBIN] You will count the number of random values in the bin array. For example, bin[0] counts the number of random values in [-4,-3.8), and bin[1] counts the number of random values in [-3.8, -3.6), and so forth. Print the array bin as a distribution of the random number. Execute the program with many different input values (count) in the scale of hundreds, thousands, and millions. 4. Bar Graph Improve the previous program to draw a histogram bar graph using ASCII characters as below, which each asterisk character represents 351 sample values. The entire width must be less than 120 characters. Execute the program with many different input values in the scale of hundreds, thousands, and millions. (Hints: Scale bin array values based on the maximum bin value) 4.00 -0.20 I*s 0.00 1 0.20 * 0.40** 3.80 * indicates 351 sample teria.repesents t inasanionr o, but not 15 [Optiona 351 or 4300. CHints: Use appropriate mathematical functions defined in math.h) 5. Exponential distribution Use the rx exponential(0 function instead of rx.norma1) to find the exponential distribution. You must adjusts constant macros properly. Execute the program with many different input values (count) in the scale of hundreds, thousands, and millions. 6. Other distribution Repeat Section 5 with rx_range() function. 7. Submission Guide Same as Lab 1. Tips! You can pass an array as a function argument using a pair of empty brackets as int foo(int x[]). In this way, however, you don't know the number of elements in the array in the function. It is a typical way in C programming language to pass the size of an array as well as the array itself so that you can safely play with the array. For example, int foo(int x[l, int nx) for (ia; i
= LIMIT-UPPER)// check the boundaries outliers++; printf("%d outliers ", outliers); For the rest of the Lab, you will copy a previous C source program to the next program with a different file name with a suffix with the section number and incrementally modify programs. In this lab, you must not use any hardcoded constant in the programs except zero and one. All constants must be defined as macros. 2. Mininum and maximum Write two functions each of them takes two double-type arguments and return a double-type. The first function return a smaller value of those two arguments, and the second function return a larger value. Use those functions to find the minimum and maximum random values and print them. Collecting the distribution 3. Change the lower and upper limits to-4 to 4 (in define macros). You will define a macro constant indicating the number of intervals in a unit value. If the interval is 5, for example, you will divide a unit value () to 5 sub-group. So, there are (4-(-4)) x 5 40 sub-groups within the boundary. You will define an array for 40 integers. Let's call this array as bin. You can define the constant and the array as #define LIMITLOWER #define LIMIT UPPER 4 4 // low limit // high limit - #define TICKS // the number of intervals in a unit #define NBIN (UPPER LIMIT-(LOWER LIMIT)) TICKS) int bin[NBIN] You will count the number of random values in the bin array. For example, bin[0] counts the number of random values in [-4,-3.8), and bin[1] counts the number of random values in [-3.8, -3.6), and so forth. Print the array bin as a distribution of the random number. Execute the program with many different input values (count) in the scale of hundreds, thousands, and millions. 4. Bar Graph Improve the previous program to draw a histogram bar graph using ASCII characters as below, which each asterisk character represents 351 sample values. The entire width must be less than 120 characters. Execute the program with many different input values in the scale of hundreds, thousands, and millions. (Hints: Scale bin array values based on the maximum bin value) 4.00 -0.20 I*s 0.00 1 0.20 * 0.40** 3.80 * indicates 351 sample teria.repesents t inasanionr o, but not 15 [Optiona 351 or 4300. CHints: Use appropriate mathematical functions defined in math.h) 5. Exponential distribution Use the rx exponential(0 function instead of rx.norma1) to find the exponential distribution. You must adjusts constant macros properly. Execute the program with many different input values (count) in the scale of hundreds, thousands, and millions. 6. Other distribution Repeat Section 5 with rx_range() function. 7. Submission Guide Same as Lab 1. Tips! You can pass an array as a function argument using a pair of empty brackets as int foo(int x[]). In this way, however, you don't know the number of elements in the array in the function. It is a typical way in C programming language to pass the size of an array as well as the array itself so that you can safely play with the array. For example, int foo(int x[l, int nx) for (ia; i= LIMIT-UPPER)// check the boundaries outliers++; printf("%d outliers ", outliers); For the rest of the Lab, you will copy a previous C source program to the next program with a different file name with a suffix with the section number and incrementally modify programs. In this lab, you must not use any hardcoded constant in the programs except zero and one. All constants must be defined as macros. 2. Mininum and maximum Write two functions each of them takes two double-type arguments and return a double-type. The first function return a smaller value of those two arguments, and the second function return a larger value. Use those functions to find the minimum and maximum random values and print them. Collecting the distribution 3. Change the lower and upper limits to-4 to 4 (in define macros). You will define a macro constant indicating the number of intervals in a unit value. If the interval is 5, for example, you will divide a unit value () to 5 sub-group. So, there are (4-(-4)) x 5 40 sub-groups within the boundary. You will define an array for 40 integers. Let's call this array as bin. You can define the constant and the array as #define LIMITLOWER #define LIMIT UPPER 4 4 // low limit // high limit