Sampling From a Normal Distribution
A filling line at Bramley Foods puts a weight into every jar that varies around the target in the familiar bell-shaped way: most jars land near the target and fewer land further out, equally often above and below. Before the line is rebuilt, the engineer wants to see on paper what a shift of 1000 jars would look like. The exercise has to be repeatable for the review board, so it is driven from a recorded seed: NumPy's classic global random stream is set from that seed before the first jar is simulated, after which 1000 jar weights are drawn from the bell curve. What the board is shown is the average weight across those 1000 simulated jars, which lands near the target without matching it.
Task: Print the average weight of the simulated shift.
Input
One line holding three values separated by single spaces: the seed as a whole number, the target weight, and the spread. The spread is the standard deviation of the bell curve — the usual measure of how far the weights scatter from the target.
Output
One line holding the average of the 1000 simulated weights, rounded to one decimal place.
Example:
Input:
1 50 5
Output:
50.2
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in