*Dungeons & Dragons* players spend a lot of time rolling 20-sided polyhedral dice, known as D20s.

In general, they’re looking to roll as high as possible to successfully stab a wyvern, jump a chasm, pick a lock, charm a Duke^{1},
or whatever.

## Roll with advantage

Sometimes, a player gets to *roll with advantage*. In this case, the player rolls *two* dice, and takes the higher roll. This really boosts their chances of not-getting a
low roll. Do you know by how much?

I dreamed about this very question last night. And then, *still in my dream*, I came up with the answer^{2}.
I woke up thinking about it^{3}
and checked my working.

The chance of getting a “natural 1” result on a D20 is 1 in 20… but when you roll with advantage, that goes down to 1 in 400: a huge improvement! The chance of rolling a 10 or 11 (2 in 20 chance of one or the other) remains the same. And the chance of a “crit” – 20 – goes up from 1 in 20 when rolling a single D20 to 39 in 400 – almost 10% – when rolling with advantage.

You can see that in the table above: the headers along the top and left are the natural rolls, the intersections are the resulting values – the higher of the two.

The nice thing about the table above (which again: was how I visualised the question in my dream!) is it really helps to visualise *why* these numbers are what they are. The
general formula for calculating the chance of a given number when rolling D20 with advantage is *( n ^{2} – (n-1)^{2} ) / 400*. That is, the square of the number
you’re looking for, minus the square of the number one less than that, over 400 (the total number of permutations)

^{4}.

## Why roll two dice when one massive one will do?

Knowing the probability matrix, it’s theoretically possible to construct a “D20 with Advantage” die^{5}. Such a tool would
have 400 sides (one 1, three 2s, five 3s… and thirty-nine 20s). Rolling-with-advantage would be a single roll.

This is probably a totally academic exercise. The only conceivable *reason* I can think of would be if you were implementing a computer system on which generating random numbers
was computationally-expensive, but memory was cheap: under this circumstance, you could pre-generate a 400-item array of possible results and randomly select from it.

But if anybody’s got a 3D printer capable of making a large tetrahectogon (yes, that’s what you call a 400-sided polygon – you learned something today!), I’d love to see an “Advantage D20” in the flesh. Or if you’d just like to implement a 3D model for Dice Box that’d be fine too!

## Footnotes

^{1} Or throw a fireball, recall an anecdote, navigate a rainforest, survive a poisoning,
sneak past a troll, swim through a magical swamp, hold on to a speeding aurochs, disarm a tripwire, fire a crossbow, mix a potion, appeal to one among a pantheon of gods, beat the
inn’s landlord at an arm-wrestling match, seduce a duergar guard, persuade a talking squirrel to spy on some bandits, hold open a heavy door, determine the nature of a curse, follow a
trail of blood, find a long-lost tome, win a drinking competition, pickpocket a sleeping ogre, bury a magic sword so deep that nobody will ever find it, pilot a spacefaring rowboat,
interpret a forgotten language, notice an imminent ambush, telepathically commune with a distant friend, accurately copy-out an ancient manuscript, perform a religious ritual, find
the secret button under the wizard’s desk, survive the blistering cold, entertain a gang of street urchins, push through a force field, resist mind control, and then compose a ballad
celebrating your adventure.

^{2} I don’t know what it says about me as a human being that sometimes I dream in
mathematics, but it perhaps shouldn’t be surprising given I’m nerdy enough to have previously recorded instances of dreaming in (a) Perl, and (b) Nethack (terminal mode).

^{3} When I woke up I also found that I had *One Jump* from Disney’s *Aladdin* stuck in my head, but I’m not sure
that’s relevant to the discussion of probability; however, it might still be a reasonable indicator of my mental state in general.

^{4} An alternative formula which is easier to read but harder to explain would be ( *2(n
– 1) + 1 ) / 400*.

^{5} Or a “D20 with Disadvantage”: the table’s basically the inverse of the advantage one –
i.e. 1 in 400 chance of a 20 through to 39 in 400 chance of a 1.