Illustrating the probability distribution.

If a computer’s random number generator is providing an accurate distribution of numbers, when you simulate the roll of two dice and record the sum, you should achieve a bell curve in the result of a thousand rolls. This program illustrates the output of the random number generating Mersenne Twister algorithm used by the random library in Python.

Write a program that outputs the number of 2’s, 3’s, 4’s etc. that are rolled by adding two random numbers between one and six. The number of rolls to simulate is input by the user.

Use this boilerplate code as a starting point:

Remember to add a comment before a subprogram, selection or iteration statement to explain its purpose.

- Takes one paramter, the number of two dice rolls to simulate.
- Rolls two dice, sums them together and adds the result to a tally. E.g. If a four and three are rolled the sum is seven, so the tally for the number seven is increased by one.
- Outputs the results for the ten possible rolls, two to twelve.

- The user can input how many rolls to simulate.
- It calls the `distribution` subprogram.

2 : 34

3 : 61

4 : 82

5 : 131

6 : 147

7 : 168

8 : 130

9 : 101

10 : 79

11 : 44

12 : 23

Use these resources as a reference to help you meet the success criteria.

Run the program several times with a thousand rolls to check that your program has met the success criteria.

Check that you have:

- Used comments within the code to describe the purpose of subprograms, conditions and iterations.
- Used meaningful identifier names. That means the names of subprograms and variables indicate what they are for.

You might want to create a chart of your results in a spreadsheet to see the bell curve.