# dnd 5e – With a known probability, how can I determine a roll to fit that probability to a population of n?

## It’s probably better to just make something up.

The problem with focusing too much on math is that it’s easy to end up spending a lot of effort on accurately sampling from a probability distribution that doesn’t actually match players’ expectations of reality.

In particular, the binomial distribution suggested by Gandalfmeansme accurately models the distribution of the number of successes in $$n$$ attempts that each succeed independently of each other with a fixed probability $$p$$. However, in real life, attempts are rarely independent and probabilities are rarely fixed.

For example, in your example of a bunch of townspeople visiting a dangerous forest, would you really expect the others not to react if something happens to one of them? (Well, maybe you would, if they all left and returned at the same time, and made sure to stay out of sight and hearing range of each other. But how plausible is that?) And is it really reasonable to assume that the risk of entering the forest is the same every day, or would it be more reasonable to assume that the forest is perfectly safe on most days, except when a pack of wandering predators or bandits or whatever just happen to be nearby.

Now, my point is not that you should adjust and complicate your math to model all these additional aspects of the situation. Rather, what I’m trying to suggest is that, since you know that your mathematical model won’t be fully realistic anyway, you should just make up something that is simple and feels reasonable, maths be damned. (And I say this as someone with a degree in applied mathematics.) And then be prepared to tweak things at the table if it feels like you should.

For example, for your dangerous forest, you could e.g. just roll a d20 once a day (in secret, if necessary!) to see if the forest is safe to visit today. If you roll 2 or above (or 3 or above, if you want to make it really dangerous), it’s safe and nothing happens. If you roll a one, there’s something dangerous lurking in the forest, and anyone who goes there will have to deal with it. Or, if that doesn’t feel right, then do something else. But keep it simple.

Similarly, for your town population example, you should first consider how many skilled and unskilled people it makes sense for this particular town to have, and what skills they should have. Is it a farming town, a fishing town or a mining town? (And if so, what do they farm, fish or mine?) Does it lie on major road or a trade route? Does it have industry? Is there a church or a shrine of some sort? Is there a fort or a military camp nearby, and is the town itself walled for defense? Is it the biggest town in the area, and if not, where and how close is the nearest bigger town? Is there anything else in the town or nearby that makes it special? Hot springs? Mysterious caves? Ancient ruins? A wizard’s tower?

In any case, no matter what the town is like, it will probably have a certain number of various skilled craftspeople like millers, weavers, shoemakers, potters, coopers, carpenters, smiths, traders, innkeepers, etc. And the number of these people in each town of a given size will be more or less the same, because if a single shoemaker can make and repair enough shoes for the whole town, it makes little sense for there to be two. More likely, if there were two but only enough demand for one, the other would move away to another town that doesn’t have its own shoemaker yet.

That is, of course, unless there’s extra demand for a particular profession due to some specific reason, like one of those I listed above. A trading town on a busy road probably has more innkeepers than a farming town out in the middle of nowhere. A military town needs blacksmiths, and so probably does a mining town (but they’ll mostly work on different things). A town that produces wine will have need of coopers (and/or potters, depending on local traditions and the availability of wood and clay). But everyone still needs shoes, although not every small town necessarily has its own shoemaker — but even if it doesn’t, there’s probably one working somewhere within a day’s travel at most.

So what it you just want to generate a random town? Well, you can start by assuming that there’s at least one of each kind of tradesperson that you feel a town of that size should probably have. (And don’t worry if you forget some, because if your players ask if the town has, say, a farrier, you can just point them at the stables and say “sure, of course it does!”) And then consider what specific trades the town might have extra demand for, and add in a bunch of those. But don’t add too many, because in a pre-modern society something like over 90% of the overall population should be farming or fishing or doing something else that directly feeds them (and indirectly feeds all the craftspeople and soldiers and anyone else who doesn’t grow or gather their own food).

In the end, basically, your town should have the population make-up that feels right to you. And you probably don’t need to plan it all in advance, either; you can just describe the town to your players in broad terms (e.g. “most people here are simple farmers, but there’s also an inn that doubles as a general store”) and make up the details if and when they come up.

## But I still want a mathy solution!

OK, fine, let’s just assume that the binomial distribution is a reasonable approximation to the real situation you want to model. What we want to do, in turn, is approximate the binomial distribution with something that requires fewer dice rolls.

First of, a helpful mathematical result known as the Poisson limit theorem says that, for large $$n$$ (and for RPG purposes, we can safely regard $$n ge 10$$ or even $$n ge 5$$ as “large”), the shape of the binomial distribution depends mostly on the expected average number of successful outcomes, which is simply the number of independent attempts $$n$$ times the probability $$p$$ of a single attempt succeeding.

Now, depending on whether this expected number of successes is (much) less than or greater than one, or approximately equal to one, we have three possible cases:

• If $$n cdot p$$ is much less than one, successes will be rare, and multiple successes even rarer. In this case, you can pretty reasonably just roll 1d100 and treat any result equal to or less than $$100 cdot n cdot p$$ as a (single) success, and any higher result as no success.

• If $$n cdot p$$ is much greater than one, the binomial distribution looks “bell curve” shaped, and is well approximated by a normal (Gaussian) distribution with mean $$mu = n cdot p$$ and variance $$sigma^2 = n cdot p cdot (1-p)$$. We can in turn approximate this normal distribution with a suitable set of dice rolls:

• For example, we could roll (approximately) $$n cdot p$$ Fudge dice, sum them up and add $$n cdot p$$ to the result.

• If $$n cdot p$$ dice is too many, divide it by $$10$$. Roll that many fudge dice, multiply the result by $$3$$ ($$approx sqrt{10}$$) and add $$n cdot p$$ to it.

• If that’s still too many dice, divide $$n cdot p$$ by $$100$$ instead. Roll that many fudge dice, multiply the result by $$10$$ ($$= sqrt{100}$$) and add $$n cdot p$$ to it.

If you don’t happen to have any Fudge dice handy, just use normal six-sided dice and subtract the number of 1s and 2s from the number of 5s and 6s.

(This method somewhat underestimates the variance for small $$p$$, and may slightly overestimate it for large $$p$$, but overall it gives pretty reasonable-looking results. For very small $$p$$ and correspondingly large $$n$$, flipping $$n cdot p$$ coins and counting the number of heads minus tails would actually give a more accurate variance than using Fudge dice. But for moderate values of $$p$$, as in your examples, the somewhat lower variance of the Fudge dice is actually a feature. And they tend to produce a smoother distribution, too.)

• If $$n cdot p$$ is approximately one (say, between 0.2 and 5), both of the previous methods can produce poor results.* In this case, we can make use of the Poisson limit theorem mentioned above, and approximate the binomial distribution we want with another binomial distribution that has a smaller $$n$$ but a correspondingly higher $$p$$.

For example, instead of rolling 20d20 and counting 1s to find out how many out of 20 residents encounter something in the forest, you can instead roll 6d6 or even 4d4 and get approximately the same distribution.

More generally, you could e.g. roll $$X$$d20 and count the number of results less than or equal to $$n cdot p cdot 20 mathbin/ X$$. Of course, for this approximation to make sense, this threshold should be at least 1 and less than 20. (In fact, it should preferably be 10 or less.)

BTW, regardless of which method you use, if the success probability $$p$$ is greater than 50%, you should swap the outcomes so that $$p$$ becomes less than 50% before applying any of the approximations above.

*) Depending on the exact values of $$n$$ and $$p$$ and the level of accuracy you want, the first two methods above can sometimes be OK even for $$n cdot p$$ close to one. In particular, the Fudge dice method works decently well even for small expected success counts, as long as $$n cdot p$$ happens to be (close to) an integer, but exhibits rounding bias if it’s not.

Ps. Here’s an AnyDice script for testing the approximations given above. You can tweak the values of $$n$$ and $$p$$ (which the script expects to be a percentage, i.e. multiplied by 100) to see how the various approximations compare to the exact binomial distribution.

While the script applies some checks on the value of $$n cdot p$$ to avoid displaying approximations that make absolutely no sense, the checks are deliberately rather loose, as it’s potentially interesting to see how the approximations start to break down at the edges of their validity region.

For example, for your forest encounter example (with $$n = 20$$ and $$p = 0.05$$), the script shows the following possible approximations:

You can see that all the approximations shown in the plot get the expected number of encounters ($$n cdot p = 1$$) correct, while all but the d100 method (which isn’t really applicable for such high values of $$n cdot p$$ anyway) also produce a standard deviation that’s at least in the right ballpark. But in this case, the “count rolls ≤ 4 in 5d20” method is a lot better than the others in getting the shape of the distribution right.

Meanwhile, for your town population example (with $$n = 200$$ and $$p = 0.3$$), the output looks like this:

In this case, only the Fudge dice approximations are shown, as they’re the only ones suitable for such high expectation values ($$n cdot p = 60$$). The first approximation is clearly very close, but requires rolling 60 Fudge dice — which is better than, say, 200d20, but still kind of impractical. The second approximation only requires 6 rolls instead of 60, but does have the disadvantage of always producing a result that is a multiple of 3 (which is why the graph looks funny). If you wanted to smooth it out, you could always roll one extra Fudge die and add it to the result without multiplying it by 3.