Hi. We’re going to roll some dice today! 🎲

If you haven’t already, you should read 💰 Flipping Coins first.

Let’s do the math first. A die has 6 faces:

(1/6) * 100 = 16.666%

You have 17% chance of getting a specific number from any given dice roll. In other words, if you roll the dice 100 times, you should expect each of these counts below to be 17.

  ({count})

{result}

# of 1s: {s1}

# of 2s: {s2}

# of 3s: {s3}

# of 4s: {s4}

# of 5s: {s5}

# of 6s: {s6}

Initially, this may not seem as fun as flipping coins. But it actually presents us a great opportunity to test the Law of large numbers:

The law of large numbers (LLN) is a theorem that describes the result of performing the same experiment a large number of times. According to the law, the average of the results obtained from a large number of trials should be close to the expected value, and will tend to become closer as more trials are performed.

It makes sense. Imagine a random number generator that generates numbers between 1 and 100. The average of all the numbers generated should approach 50 as we keep using the generator. The law can be used with any kind of experiment, including a coin toss. But, we happen to be working with dice right now. Interestingly enough, the example use case given by the article:

According to the law of large numbers, if a large number of six-sided dice are rolled, the average of their values (sometimes called the sample mean) is likely to be close to 3.5, with the precision increasing as more dice are rolled.

Let’s jump in and start calculating the average. To do that, we will just add up the values obtained after each roll and then divide that sum by the number of rolls.

  ({count})

{result}

# of 1s: {s1}

# of 2s: {s2}

# of 3s: {s3}

# of 4s: {s4}

# of 5s: {s5}

# of 6s: {s6}

AVERAGE: {average}

Alright. Pretty cool. Were you able to get something very close to 3.50?

If you haven’t, you just need to keep rolling the dice. In the long run, the imbalance will sort itself out, unless you somehow broke the universe. 🙂