Use the Seed function to control the process of generating new sets of random numbers.
1. Use functions Seed and rnorm in a short program to generate identical sets of normally distributed random numbers for three iterations by resetting the Seed value.
• The same set of random numbers is generated each time because the seed is set to 1.
• SameNormal returns a matrix of three identical columns, one for each iteration.
2. Use functions hist and max to plot a histogram of the second random set with n_bins bins. Add a horizontal marker to show the maximum of the returned set.
3. Modify the program to generate three different sets of normally distributed random numbers by incrementing the seed value with each iteration.
• Now that the seed value changes with each iteration, each set of random numbers is unique.
• Since iteration=0 of both programs starts with seed=1, column=0 of both returned matrices contain identical sets.
4. Extract the second data set from the returned matrix:
5. Use function hist to generate a histogram of the random set with n_bins bins, then calculate its maximum.
6. Plot the histogram and use a horizontal marker to show its maximum: