## Assigning Random Numbers - Simulation

Simulation: a mathematical model that can be used to test what might happen in situations where an experiment with real subjects may be too dangerous or take too long.

Monte Carlo methods – involve elements of chance.

Random devices:

To carry out simulations of real life processes, we must formulate (or are given) a probability distribution of discrete random variable X.

The probability distribution for the numbers which appear on a non-bias 6-sided die is

Monte Carlo methods – involve elements of chance.

Random devices:

- Dice
- Coins
- Random numbers

To carry out simulations of real life processes, we must formulate (or are given) a probability distribution of discrete random variable X.

The probability distribution for the numbers which appear on a non-bias 6-sided die is

**uniformly distributed**:x |
1 |
2 |
3 |
4 |
5 |
6 |

P(X = x) |
1/6 |
1/6 |
1/6 |
1/6 |
1/6 |
1/6 |

This means that the probability of rolling each number is

Not all distributions are uniform, however.

We use random numbers to simulate real life situations in accordance with a probability distribution. This means allocating a set of numbers to each discrete variable based on its probability of occurring. Most random number devices, such as calculators, give random numbers as decimals – so we look at the first decimal place (without rounding) if we are simulating using 1-digit numbers. If we are using 2-digit numbers, then look at the first 2 decimal places, without rounding. In your exam you will likely be printed a set of random numbers.

Given distribution:

*exactly the same*. Here we can see that the probability of rolling each number is 1/6.Not all distributions are uniform, however.

__Random numbers__We use random numbers to simulate real life situations in accordance with a probability distribution. This means allocating a set of numbers to each discrete variable based on its probability of occurring. Most random number devices, such as calculators, give random numbers as decimals – so we look at the first decimal place (without rounding) if we are simulating using 1-digit numbers. If we are using 2-digit numbers, then look at the first 2 decimal places, without rounding. In your exam you will likely be printed a set of random numbers.

**Example (1-digit):**Given distribution:

Find a common denominator for all of the probabilities. For this example, it would be 10.

If the common denominator is ≤10, then you will likely be using a 1-digit random number simulation. This means allocating the numbers from 0-9 to each discrete variable according to their probability.

We attach the same number of random numbers as the numerator tells us. Here you can see that the random numbers fit perfectly – since our common denominator is 10, we do not have any numbers ‘wasted’. This is not always the case, as you will soon see. For one digit numbers, try and get the denominator as close to 10 as possible.

Given distribution:

**Example (2-digit):**Given distribution:

Find a common denominator for all of the probabilities. For this example, it would be 24. This means it will be a 2-digit random digit simulation – so we try and make the denominator as close to 100 as possible.

The common denominator here is 96. This means that the random numbers will not fit perfectly:

Here we can see that the random numbers 96-99 are not assigned to any variable. These 4 numbers are wasted. It’s important that we state that we ‘ignore and redraw’ if we come across one of them.

i.e. Ignore and redraw for 96-99.

This means we just check the next random number.

i.e. Ignore and redraw for 96-99.

This means we just check the next random number.