Math and D&D: An Introduction to Probabilities

D&D uses a lot of math in its gameplay and most of it is focused around probabilities. But how does it really works? For this first article we will define the basis of probabilities and what it means to throw die.

A Matter of Sheer Luck

There are two kinds of probabilities: continuous and discrete. The differences between them lies in their sample set. Continuous is based on an interval with an infinity of outcomes inside. Discrete, however, has a limited set who can be enumerated.

A random variable \(X\) is a variable that has for values the numerical outcomes of a probability. A probablity distribution \(\mathbb{P}\) of a random variable maps every outcome to their respective probability. All the possible outcomes of a probability distribution is contained in a set called sample set and wrote \(\Omega\).

The expectation of a random variable is the average value taken:

\[\mathbb{E}[x] = \sum_{x \in X(\Omega)} x\mathbb{P}(x)\]

The variance is the average of the squared differences from the mean.

\[Var[x] = \sum_{x \in X(\Omega)} \mathbb{p}(x) \times (x - \mathbb{E}[x])^2\]

And finally the standard deviation is the square root of the variance.

\[\sigma[x] = \sqrt{Var[x]}\]

A data set is a generated set using a probability distribution. Each elements of this set is independent and identically distributed. The points are usually wrote \((x_1, \ldots, x_n), n \in \mathbb{N}\).

From this set we can provide an analysis to get more insight of the distribution. There are two kinds of measures, ones focused on the center of the distribution, and others, focused on the spreading. Let's start with the central tendency measures.

The mean is the average value of the data set.

\[\bar{x} = \frac{1}{n} \sum x_i\]

The mode is the most frequent value inside the set. The median is the middle value of the ordered set It splits the data set in two halves.

Then there are the dispersion measures. The range is the difference between the maximum and the minimum value of the set. A percentile show the value below which a percentage of the set falls. Quartiles are the 25th and 75th percentiles and the interquartile range or IQR is the difference between the two.

Peasant or God? Faites vos jeux!

At the beginning of every characters, we have to get their stats. For that there are two possibilities, the buying system or the die. Obviously, in the case of our article we are using the later.

Stats are very important since they define most of the character'sgameplay: If you have a lot of wisdom you might consider going for a wizard. If it's sheer strength, then barbarian is a better choice etc... Finally, the bigger a stat is, the better.

We have multiple choices to get our randomly generated numbers:

  • 1d20
  • 3d6
  • 4d6 removing the lowest or the highest d6
  • 5d6 removing the lowests or the highests 2d6

Which one is the best? It all depends of your play style and what the odds have to offer.

The Gambler: 1d20

Let's begin with a single dice. The probabilities behind it is straightforward. There are 20 possibles values, ranging from 1 to 20, all with 5% chance of being rolled.

\[\Omega = \{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20\}\]

\[\Omega = [1 \ldots 20]\]

\[\forall x \in \Omega, \mathbb{P}(x) = \frac{1}{20} = 0.05\]

Probability Mass Function of 1d20.

Name Value
Mean 10.50
Mode None
Median 10
Range 19
Quartiles 5.75, 15.25
IQR 10
Standard Deviation 5.916

Due to its perfect randomness, we can't give a prediction on the outcome.

\[\mathbb{P}(\{1, 2, 3, 4, 5, 6\}) = 6 \times 0.05 = 0.3\]

You have 30% chances of getting a very bad stats for a character which is very high. Yet it's the same probability as getting a stat in the higher pool (14 to 20). I wouldn't recommand using this method for those reasons, unless you're a professionnal gambler and like challenges.

The Average: 3d6

What about using three 6-sided die at the same time? Well, it changes everything about the probabilities. Instead of having an equiprobable distribution we have now a Binomial one.

A Binomial distribution models the number of successes in a sequence of experiments.

\[\mathbb{B}(n, p) = \binom{n}{k}p^k(1-p)^{n-k}\]

\(n\) is the number of experiments, \(p\) the probability of success and \(k\) the number of successes in the experiments. \(\binom{n}{k}\) is called the Binomial coefficient.

\[\binom{n}{k} = \frac{n!}{k!(n-k)!}\]

In our case, since we are using 3d6, we have \(n=3\), \(p=\frac{1}{6}\), \(k=3\) to get the probability of getting \((6,6,6)\).

\[\mathbb{B}(3, \frac{1}{6})= \binom{3}{3}\frac{1}{6^3}(1-\frac{1}{6})^{3-3} = \frac{1}{216}\]

Now that we have the probability for each outcomes of a 3d6 we can multiply it by the number of possibilities for getting a 5 or a 6. Let's create a new probability \(\mathbb{P}\) for that.

We have 6 different combinations of having 5:

\[\{(1, 1, 3), (1, 3, 1), (3, 1, 1), (2, 1, 2),(1, 2, 2), (2, 2, 1)\}\]

\[\mathbb{P}(5) = 6 \times \frac{1}{216}\]

3 4 5 6 7 8 9 10
0.462 1.388 2.777 4.629 6.944 9.722 11.574 12.5
11 12 13 14 15 16 17 18
12.5 11.574 9.722 6.944 4.629 2.777 1.388 0.462

Probability Mass Function of 3d6.

Name Value
Mean 10.50
Mode 11, 12
Median 10.50
Range 15
Quartiles 8.00, 13.00
Standard Deviation 2.964

As we can see with the graph and the data below, our values are now centered around 11 and 12 with 50% of the probabilities shared in the \([8,13]\) range. Another interesting thing, the more you try to reach the external values, the harder it gets.

In terms of odds it means that you have more chances to get a middle value than a border one. It makes your stats not too good and not too bad, with an overall balanced character.

Knights and Grunts: 4d6 - Lowest/Highest d6

What happens if you add more die to the rolling? Well, the values increases but the tendency stays the same. We still are on a classical Binomial model. But what about ignoring certain dice of the rolling to still have a value between 3 and 18?

Depending of which die you chose to remove, the curve will go in a direction or another. By removing the lowest, you get higher chances to have bigger values. Respectively, if you remove the bigger one, you'll end up with much more lower values.

3 4 5 6 7 8 9 10
Lowest 0.077 0.308 0.771 1.620 2.932 4.783 7.021 9.413
Highest 1.620 4.166 7.253 10.108 12.345 13.271 12.885 11.419
11 12 13 14 15 16 17 18
Lowest 11.419 12.885 13.271 12.345 10.108 7.253 4.166 1.620
Highest 9.413 7.021 4.783 2.932 1.620 0.771 0.308 0.077

Probability Mass Function of 4d6 - lowest d6.

Probability Mass Function of 4d6 - highest d6.

Name Lowest Highest
Mean 12.244 8.755
Mode 13 8
Median 12 9
Range 15 15
Quartiles 10, 14 7, 11
IQR 4 4
Standard Deviation 2.847 2.847

Heroes and Peons: 5d6 - Lowests/Highests 2d6

By adding more dice and keeping the highest or the lowest, the probability shift accordingly. We can see it by comparing 4d6 and 5d6. The median, mode and mean is getting bigger (resp lower) as well as the quartiles. On the other hand, the standard deviation and the IQR is getting smaller. The pool of values between the two quartiles, holding the half of the probability is reducing.

3 4 5 6 7 8 9 10
Lowests 0.012 0.064 0.192 0.527 1.157 2.186 3.806 6.044
Highests 3.549 7.844 12.024 14.287 14.853 13.567 11.329 8.551
11 12 13 14 15 16 17 18
Lowests 8.551 11.329 13.567 14.853 14.287 12.024 7.844 3.549
Highests 6.044 3.806 2.186 1.157 0.527 0.192 0.064 0.012

Probability Mass Function of 5d6 - lowests 2d6.

Probability Mass Function of 5d6 - highests 2d6.

Name Lowests Highests
Mean 13.430 7.569
Mode 14 7
Median 14 7
Range 15 15
Quartiles 12,15 6, 9
IQR 3 3
Standard Deviation 2.603 2.603


As we saw through this post, there are multiple ways of getting generated numbers for our stats. Some are better than other, but at the end of the day, it doesn't matter. It all depends on the way you want to play your character.

Are you in a low fantasy genre? Then you might prefer a weaker character and you might choose 4d6. Or maybe you're some divinity incarnation, some kind of demigod that seeks justice on a high fantasy setting. The 5d6 method will provide you with more fitting stats.

It's only a small part about RNG in Dungeons & Dragons. In fact we only scratched the bottom and there are more to dig such as combats, actions or even loots. But it will be for another article.