# How do I determine the probability of rolling various ranges of numbers on 4d10, 5d10, etc.?

After realizing that my knowledge of how probabilities function has waned significantly, I'm wondering what the probability of rolling multiple 6's or higher (6-10) on four 10-sided dice, five 10-sided dice, etc. up to nine 10-sided dice.

As well, what the probability of rolling a 7 or higher, 8 or higher, 9 or higher on the same sets of dice as mentioned above.

Something like;
%chance rolling 3 of 6-10 on 4d10,
%chance rolling 3 of 7-10 on 4d10,
%chance rolling 3 of 8-10 on 4d10,
%chance rolling 3 of 9-10 on 4d10, etc.

%chance rolling 3/4/5 of 6-10 on 5d10...
etc.

I've tried creating some functions on AnyDice, but I either can't get the function(s) to work, or I fear I may be misunderstanding my results.

How do I make this work?

• Are you asking for at least three high rolls (out of X rolls of a d10), or are you asking for exactly three high rolls (out of X rolls of a d10)? – Greg Faust Dec 20 '18 at 19:36
• Exactly three is what I'm most interested in currently, but I'm also looking for the probability of more than three as well. – Brett Lindsay Dec 20 '18 at 23:55

You should instruct anydice to roll a number custom dice, where the definition of the custom die includes a number of zeroes equal to the number of die-faces that do nothing, and a number of ones for number of faces which count as 'successful'. E.g. for 4d10 where dice coming up 6 or more count as successful and contribute to your final score (also known as rolling 4 dice against difficulty 6), use this:

output 4d{0,0,0,0,0,1,1,1,1,1}

This can be abbreviated by to a format Xd{0:a,1:b}, where 'X' is the number of dice, 'a' is the number of faces that give no successes, and 'b' is the number of faces that do give a success, such that a=(difficulty-1) and b=(11-difficulty). So for 4 dice at difficulty 6, it's written like this:

output 4d{0:5,1:5}

If instead you want to roll seven dice and wonder how many will come up 9-or-better, use this:

output 7d{0:8,1:2}

Now, in some systems, such as Storyteller / World of Darkness / Exalted, dice that come up with the '1' face subtract from your final score. If so, replace the first zero with a '-1'. Conversely, if dice that come up with the '10' face count as two successes, replace the final '1' with a '2', like this (when rolling 12 dice against difficulty 7):

output 12d{-1,0:5,1:3,2}

As a side note, while it's possible to roll normal d10s and give conditional counting instructions, use custom functions etc., it seems to often cause such a workload for the server that it times out without giving a result, particularly with high dice pools. The custom die format seems to avoid the timeout problem. So from now on I avoid the less efficient method and stick to the one I described above.

I've just been told that using the

output 7d(d10>=9)

format is safe (where 9 is the difficulty), and when I just tested it it worked OK, but at other times I've had timeouts with it. So it's for you to decide whether to use it for cases where you don't care about 1's and 10's.

### Reading the results

Anydice provides table and graph result formats, and can offer you an 'exactly' (probability of a given specific outcome), 'at least' (probability of outcomes of this much or better) and 'at most' (probability of outcomes this low or lower) values. When playing games where there's no downside for higher success scores, you want the 'at least' scores. For games where overshooting an intended score can be dangerous, (I know of only one such game, but it doesn't use dice pools), you should look at the sum of exact probabilities of all scores in an acceptable bracket - that's your chance of getting the desired outcome.

• As mentioned in Cody P's answer, you can construct those custom dice by applying an expression or a function to a normal d10, e.g. 7d(d10 >= 9) or even 7d[count {9..10} in d10] instead of 7d{0:8,1:2}. At least I find that easier to read and less prone to typos. For the WoD style counting, you'd need to write a custom function. (Also, while testing that, I noticed that your WoD-style example has a typo: you're rolling a d9 vs. 6 instead of a d10 vs. 7.) – Ilmari Karonen Dec 20 '18 at 21:36
• @IlmariKaronen Fixed the error introduced in the abbreviation edit; made it more obvious why I'm avoiding more intensive approaches like (d10>=N). – vicky_molokh- unsilence Monica Dec 20 '18 at 23:22
• Using 7d(d10 >= 9) or 7d[count {9..10} in d10] is just as fast as 7d{0:8,1:2}. If you don't believe me, try 999d(d100 >= 90) or something. What's slow is doing [count {9..10} in 7d10], because then AnyDice ends up looping over every possible result of rolling 7d10 just to count the nines and tens in them. – Ilmari Karonen Dec 20 '18 at 23:43
• Couldn't you just roll 7d10 normally and look at the "at least" score for whatever your target number is, instead of custom dice? – Bobson Dec 21 '18 at 19:54
• @Bobson Assuming I understand your question correctly, then no, that would produce the probabilities of rolling a sum on the dice and not the probabilities of rolling this many dice with the right side up. – vicky_molokh- unsilence Monica Dec 21 '18 at 22:41

I think these kinds of questions are a lot easier to consider visually than they are to consider through the raw math.

Let's start with a simple question, and try to work up to the answer: What are the odds of rolling at least 1 10 when rolling 2d10?

Again, avoiding complex arithmetic, let's instead construct a table that represents all the possibilities for each outcome.

First, consider the outcomes for a single d10:

$$\begin{array}{r|lllllllll} & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ \hline \text{1d10} & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \end{array}$$

To construct this table, we'll take two of these arrays and multiply them together to form the values in each cell.

Fortunately, the value for each one is 1, so that's pretty easy:

$$\begin{array}{r|llllllllll} 10 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ 9 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ 8 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ 7 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ 6 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ 5 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ 4 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ 3 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ 2 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ \hline \text{2d10} & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \end{array}$$

Now we'll mark all of the outcomes where we had at least 1 10 rolled.

$$\begin{array}{r|llllllllll} 10 & 1* & 1* & 1* & 1* & 1* & 1* & 1* & 1* & 1* & \text{1**} \\ 9 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1* \\ 8 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1* \\ 7 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1* \\ 6 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1* \\ 5 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1* \\ 4 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1* \\ 3 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1* \\ 2 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1* \\ 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1* \\ \hline \text{2d10} & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \end{array}$$

Then we'll accumulate all of these outcomes, and see that we have 1 outcome where we got 2 10s, 18 outcomes with 1, and 81 outcomes where we didn't.

So one could say that we can then simplify this down into an array:

$$\begin{array}{r|lll} & 81 & 18 & 1 \\ \hline \text{2d10} & 0 & 1 & 2 \end{array}$$

So if we were calculating "what are the odds of rolling at least 1 10", we say "19/100", if we say "what are the odds of rolling exactly 1 10, we say "18/100".

What about rolling 6 or higher?

$$\begin{array}{r|llllllllll} 10 & 1* & 1* & 1* & 1* & 1* & \text{1**} & \text{1**} & \text{1**} & \text{1**} & \text{1**} \\ 9 & 1* & 1* & 1* & 1* & 1* & \text{1**} & \text{1**} & \text{1**} & \text{1**} & \text{1**} \\ 8 & 1* & 1* & 1* & 1* & 1* & \text{1**} & \text{1**} & \text{1**} & \text{1**} & \text{1**} \\ 7 & 1* & 1* & 1* & 1* & 1* & \text{1**} & \text{1**} & \text{1**} & \text{1**} & \text{1**} \\ 6 & 1* & 1* & 1* & 1* & 1* & \text{1**} & \text{1**} & \text{1**} & \text{1**} & \text{1**} \\ 5 & 1 & 1 & 1 & 1 & 1 & 1* & 1* & 1* & 1* & 1* \\ 4 & 1 & 1 & 1 & 1 & 1 & 1* & 1* & 1* & 1* & 1* \\ 3 & 1 & 1 & 1 & 1 & 1 & 1* & 1* & 1* & 1* & 1* \\ 2 & 1 & 1 & 1 & 1 & 1 & 1* & 1* & 1* & 1* & 1* \\ 1 & 1 & 1 & 1 & 1 & 1 & 1* & 1* & 1* & 1* & 1* \\ \hline \text{2d10} & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \end{array}$$

Let's get the simplified array version:

$$\begin{array}{r|lll} & 25 & 50 & 25 \\ \hline \text{2d10} & 0 & 1 & 2 \end{array}$$

So hopefully now you see how this technique works for any possible number you could search for in the original table.

So now let's expand it. What about 3d10, with the odds of rolling at least 2 10s?

Well, we could try to construct a 3-dimensional matrix using those 3 different dice, but that seems like a lot of work. Why don't we just set this 1-dim array as one of the axis to represent 2d10, and set the other axis as the new 1d10?

Bear in mind we have to multiply these arrays together though, so we'll need to handle that first:

$$\begin{array}{r|llllllllll} 2 & \text{1**} & \text{1**} & \text{1**} & \text{1**} & \text{1**} & \text{1**} & \text{1**} & \text{1**} & \text{1**} & \text{1***} \\ 1 & \text{18*} & \text{18*} & \text{18*} & \text{18*} & \text{18*} & \text{18*} & \text{18*} & \text{18*} & \text{18*} & \text{18**} \\ 0 & 81 & 81 & 81 & 81 & 81 & 81 & 81 & 81 & 81 & \text{81*} \\ \hline \text{2d10/1d10} & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \end{array}$$

I've combined 2 steps and marked all the cells with the number of 10s we can count.

So we'll reduce down to an array again: 0 is 729 (9 * 81), 1 is 243 (18 * 9 + 81), 2 is 27 (1 * 9 + 18), and 3 is 1.

$$\begin{array}{r|lll} & \text{729} & \text{243} & \text{27} & \text{1} \\ \hline \text{3d10} & 0 & 1 & 2 & 3 \end{array}$$

So here, there's a (27 + 1) 28/1000 chance of rolling at least 2 10s on a 3d10. There's a 27/1000 chance of rolling exactly 2 10s, and a 729/1000 chance of rolling no 10s at all.

We'll do it one more time with the 6's example:

$$\begin{array}{r|llllllllll} 2 & \text{25**} & \text{25**} & \text{25**} & \text{25**} & \text{25**} & \text{25***} & \text{25***} & \text{25***} & \text{25***} & \text{25***} \\ 1 & \text{50*} & \text{50*} & \text{50*} & \text{50*} & \text{50*} & \text{50**} & \text{50**} & \text{50**} & \text{50**} & \text{50**} \\ 0 & 25 & 25 & 25 & 25 & 25 & \text{25*} & \text{25*} & \text{25*} & \text{25*} & \text{25*} \\ \hline \text{2d10/1d10} & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \end{array}$$

$$\begin{array}{r|lll} & \text{125} & \text{375} & \text{375} & \text{125} \\ \hline \text{3d10} & 0 & 1 & 2 & 3 \end{array}$$

A 125/1000 chance of all numbers below 6, a 375/1000 chance of exactly 1 number between 6 and 10, a 375/1000 chance of 2 numbers between 6 and 10, and a 125/1000 chance of all three numbers between 6 and 10.

This technique can be expanded to any number of dice you want. It also works for combinations of dice. For example, what are the odds of rolling 2 numbers at least 5 on a 1d6+1d8?

$$\begin{array}{r|llllllll} 6 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ 5 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ 4 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ 3 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ 2 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ \hline \text{1d6/1d8} & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 \end{array}$$

$$\begin{array}{l|lll} & 16 & 24 & 8 \\ \hline \text{1d6/1d8} & 0 & 1 & 2 \end{array}$$

So the odds of rolling 2 numbers of at least 5 are 8/48 in this example, or 1/6.

Now, I'm not disparaging the raw mathematician's approach of providing %'s and decimal numbers. But for me, this is a far more intuitive approach to solving the problem, and it gives me an easy way to work out how to expand the table for more complex dice rolls without needing to think in higher dimensions or deal with the complex rules associated with statistical probability.

Having said that: if you do know those rules, they'll give you the same math I'm performing here, just in a more direct manner. This just lets you understand the underlying mechanics in play.

# One last example

Just to bring it all home.

We're rolling 6d10. We want to know how many rolls we get that are 7 or higher. Let's generate those tables. Using our original 1d10x1d10, we get our 2d10:

$$\begin{array}{r|lll} & 36 & 48 & 16 \\ \hline \text{2d10} & 0 & 1 & 2 \end{array}$$

To get 3d10, we combine 1d10 and 2d10.

$$\begin{array}{r|llllllllll} 2 & 16 & 16 & 16 & 16 & 16 & 16 & 16 & 16 & 16 & 16 \\ 1 & 48 & 48 & 48 & 48 & 48 & 48 & 48 & 48 & 48 & 48 \\ 0 & 36 & 36 & 36 & 36 & 36 & 36 & 36 & 36 & 36 & 36 \\ \hline \text{2d10/1d10} & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \end{array}$$

Which we reduce to an array

$$\begin{array}{r|llll} & 216 & 432 & 288 & 64 \\ \hline \text{3d10} & 0 & 1 & 2 & 3 \end{array}$$

And then we create a table out of this array multiplied by itself

$$\begin{array}{r|llll} 3 & 13824 & 27648 & 18432 & 4096 \\ 2 & 62208 & 124416 & 82944 & 18432 \\ 1 & 93312 & 186624 & 124416 & 27648 \\ 0 & 46656 & 93312 & 62208 & 13824 \\ \hline \text{3d10/3d10} & 0 & 1 & 2 & 3 \end{array}$$

And finally, we reduce this table down to an array.

$$\begin{array}{r|llll} & 46656 & 186624 & 311040 & 276480 & 138240 & 36864 & 4096 \\ \hline \text{6d10} & 0 & 1 & 2 & 3 & 4 & 5 & 6 \end{array}$$

So the odds of rolling exactly 4 numbers greater than or equal to 7 on 6d10 is 138,240/1,000,000. The odds of rolling at least 4 numbers greater than or equal to 7 on 6d10 is 179,200/1,000,000. The odds of rolling no numbers greater than or equal to 7 is 46,656/1,000,000.

Just simple addition and multiplication, very little other math theory needed.

• Burn the witch! (great answer. Great, headache-inducing answer) – goodguy5 Dec 20 '18 at 20:11
• This is great advice. I work with probabilities for a living and I still frequently go back to "make a table of equiprobable outcomes and count the ones you want". – Eric Lippert Dec 20 '18 at 20:21
• Just curious, why are the tables all upside down (labels on the bottom+left instead of the top+left)? – user3067860 Dec 21 '18 at 14:40
• @user3067860 Just existing convention. When I learned this technique, that's how the tables were organized, so I'm reusing the same convention. – Xirema Dec 21 '18 at 17:08

Generically, if you are counting a target value of t on an m sided dice, with the die roll being represented as random variable D, probability of getting a specific value is, of course, p(D=t) = 1/m. If you are trying to get t or higher on an individual roll, you have probability of success of p(D>=t) = (m-t+1)/m.

• For example your chance of 7 or higher on a d10 is P(D>=7) = (10-7+1)/10 = 4/10. On AnyDice this would be 1d10>=7.

When rolling multiple dice rolls independently (and not adding them up), we can calculate the odds of a particular combination by multiplication. For example, the probability of getting two rolls higher than 7 and then two rolls lower than 7, in that order, is P(D1 >= 7) * P(D2 >= 7) * P(D3 < 7) * P(D3 < 7) = 0.4*0.4*0.6*0.6.

• On AnyDice this would be 1d10>=7 & 1d10>=7 & 1d10<7 & 1d10<7.

However, we don't want dice rolls in a specific, ordered, combination, like two successes then two failures. Any combination of two successes and two failures will do. So we need the number of ways to get exactly two successes in four rolls, which uses the "number of combinations" rule or nCr. 4 choose 2 = 6, so we multiply our earlier 0.4*0.4*0.6*0.6 by 6 to get that the odds of getting at least 2 rolls of at least 7 on 4d10 is 34.56%.

The general formula here is a Binomial distribution:

p_success^num_successes * p_failure^num_failures * nCr(num_failures+num_successes, num_successes)


On AnyDice, the easiest way I know to get combinations like this is to compare first then add the variables together. So if you type in a formula like this you'll get the distribution for the count of 4d10 rolls at least 7.

output (1d10>=7) + (1d10>=7) + (1d10>=7) + (1d10>=7)


or

output 4d(1d10>=7)


For large numbers of dice rolls (at least 14 for our d10>=7 example), the normal distribution is a good approximation of these outcomes. Note that the related distribution of the total of several dice rolls is given on Wolfram and Stats SE, or are pretty trivial to compute on Anydice with formulas like (3d6+1d8)>10.

For an analytical solution.

## Bernoulli Distribution

Rolling a dice and interpreting the result as a success/fail outcome is a Bernoulli Distribution. A Bernoulli distribution only has one parameter $$\p\$$ the probability of a success. However, it is also convenient to define $$\q\$$ the probability of a failure such that $$\q=1-p\$$.

For your question, $$\p\$$ is the probability of rolling the target number or higher on the given dice. I assume you can do this but just for completeness, for a target number $$\t\$$ on a $$\d\$$ sided dice, the probability of success is $$\p = {{d-t+1}\over d}\$$.

## Binomial Distribution

Counting the number of successes in $$\n\$$ independent Bernoulli tests is a Binomial Distribution. The probability mass function (i.e. the chance of exactly $$\k\$$ successes of a Binomial Distribution is:

$$f(k,n,p)=\text{Pr}(X=k)=\binom{n}{k}p^kq^{n-k}$$

for $$\k=0, 1,2, ...,n\$$, where

$$\binom{n}{k}={{n!}\over{k!(n-k)!}}$$

is the binomial coefficient.

## Example

%chance rolling 3 of 6-10 on 4d10

$$t=6, d=10, n=4, k=3$$

\begin{align}p&={{d-t+1}\over d}\\ &={{10-6+1}\over 10}\\ &=0.5 \end{align}

\begin{align}\text{Pr}(X=k=3)&=\binom{n}{k}p^kq^{n-k}\\ &=\binom{4}{3}0.5^30.5^{4-3}\\ &={{4!}\over{3!(4-3)!}}0.125\times0.5\\ &={{4\times 3\times 2 \times 1}\over{3\times 2 \times 1(1)}}0.125\times0.5\\ &=4\times0.0625\\ &=0.25 \end{align}

Or, in Excel

=BINOM.DIST(3,4,0.5,FALSE)


One of the ways you can simplify this problem is to model your dice as a simpler concept. Suppose we have a coin that is "fair"; that is, it is heads 50% of the time and tails 50% of the time. Rolling a fair d10 and asking "is it 1-5 or 6-10"? is logically the same as flipping a fair coin and asking "is it heads or tails?" If that idea doesn't make sense, then stop and think about it until it does.

OK, so let's suppose we have a fair coin and we are going to flip it four times. What are the possible outcomes? There are only 16:

HHHH, HHHT, HHTH, HHTT,
HTHH, HTHT, HTTH, HTTT,
THHH, THHT, THTH, THTT,
TTHH, TTHT, TTTH, TTTT


Each possibility is equally likely. (Do you see why?)

Our question then is "what is the probability of multiple tails?" Well, just read it off the chart. There are 16 possibilities, and 10 of them have multiple tails, so the probability is 10/16. (Note this is not odds; it's not 10 to 16 odds. The probability of success is the fraction 10/16ths. Odds is the ratio of successful outcomes to failure outcomes; probability is the ratio of successes to total outcomes.)

Now, this becomes difficult when we have nine fair coins to flip because there are 512 possibilities, which is a lot to list. Certainly not impossible, but a lot.

For the nine coins case, we can simplify the problem using the following trick:

• Let P2m be the probability of two or more tails.
• Let P1 be the probability of exactly one tail.
• Let P0 be the probability of no tails.
• Plainly P2m + P1 + P0 must equal 1 because these possibilities do not overlap, and there are no other possibilities.
• Therefore, if we can calculate P0 and P1, we can calculate P2m.

P0 is the probability of HHHHHHHHH, which is 1/512. For P1, there are only nine possibilities: HHHHHHHHT, HHHHHHHTH, ... THHHHHHHH. Each is equally probable, so P1 is equal to 9/512. Therefore P2m must be 502/512. You are highly likely to get at least two 6-10 rolls on 9d10; about 98% of the time that will happen.

Now what about the 7-10 case? Now we say that the coin is unfair, and is biased towards heads. That is, 60% of the time it comes up heads and 40% of the time it comes up tails. Now we can do the same analysis, but with this in mind. The probability of each outcome is the product of the probabilities of each component. So if we have

HHHH


with our four-flip model and it is 60% likely heads, the probability is (6x6x6x6)/(10x10x10x10).

Similarly if we have

HTTH


the probability of that is 6x4x4x6/(10x10x10x10).

So now again we can work out the probability of two or more tails on four unfair coin flips. There are ten possibilities; compute the probability of each, add them up, and that's the answer.

I use T-Roll for things like this (the name, by the way, stands for "Turing complete dice roller").

Simple things like what your looking for are relatively easy to set up. And lots of people have created various functions already.

For example the Shadowrun d6 counter is pretty close to what we want. All we have to do is remove the accumulator and change the die size to d10. Or we could use the WoD dice pool and remove the accumulator.

N:=3; \ number of dice
T:=7; \ threshold
count T<N#d10


This counts the number of dice that roll better than a 7 on 3d10. Change the values of N and T as desired.