Library · The Fiddler: Solutions · Chapter 131
Can You Roll the Dungeon Master’s Dice?
Two people sit at a table, each with a bag of six “DnD dice”: a d4, d6, d8, d10, d12 and d20, where a dX has faces to , all equally likely. Each person picks a die from their own bag at random, and they roll at the same time. What is the probability that both roll the same number, whether or not they picked the same kind of die?
The Fiddler, Zach Wissner-Gross, January 12, 2024(original post)
The official solution appeared in the post of January 19, 2024 and gives percent for the main puzzle, agreeing with the answer below. The Extra Credit half of that post is paywalled, so the expected number of distinct values, , is my own and has not been checked against it.
Solution
Condition on the dice. Suppose the two people hold a dX and a dY with . Whatever the smaller die shows, it is a number from to , and the larger die shows that same number with probability . So the chance of a match is Only the larger die matters. (Two d4s match one time in four; a d4 and a d20 match one time in twenty.)
Each of the ordered pairs of dice is equally likely. List the dice in order, . The pairs whose larger die is the th in this list are those with both dice among the first but not both among the first : there are of them. So which is That is a little more than half the chance for two ordinary dice. Every die carries the numbers to , and that is where most matches happen.
The computation
The program runs through every pair of dice and every pair of faces, weights each outcome by its exact probability, and adds up the matches.
from fractions import Fraction
from itertools import product
dice = [4, 6, 8, 10, 12, 20]
match = Fraction(0)
for X, Y in product(dice, repeat=2):
w = Fraction(1, 36 * X * Y) # this pair of faces
match += w * sum(1 for a in range(1, X + 1)
for b in range(1, Y + 1) if a == b)
print("P(match) =", match)
It prints
P(match) = 3/32
Extra Credit
Now three people each pick a die from their own bag at random and roll. On average, how many distinct numbers appear among the three rolls?
Solution
Count the distinct numbers one value at a time. The number of distinct values is the number of values from to that appear at least once. The average of a sum is the sum of the averages, so The three people act independently, so if is the chance that a single person rolls , A single person picks each die with chance , and a dX shows with chance if . So , which takes six values:
| – | – | – | – | – | – | |
|---|---|---|---|---|---|---|
Adding each column’s value once for every it covers, and the exact sum is For comparison, the same method gives three ordinary dice distinct values, so the mixed bag spreads the rolls out a little more.
The computation
The program enumerates every choice of three dice and every combination of faces, outcomes in all, each weighted by its exact probability, and averages the number of distinct faces.
E = Fraction(0)
for ds in product(dice, repeat=3):
w = Fraction(1, 216 * ds[0] * ds[1] * ds[2])
for faces in product(*(range(1, d + 1) for d in ds)):
E += w * len(set(faces))
print("E[distinct] =", E, float(E))
It prints
E[distinct] = 8489153/3110400 2.729280156893004