• The Infractions Forum is available for public view. Please note that if you have been suspended you will need to open a private/incognito browser window to view it.

Probability Sticky


Will GM for Beer
Validated User
Thinking of asking the mods to make a sticky thread like the resource thread to hold all the probability anydice/troll questions generated in this folder. Might be nice to have a single searchable thread that people could look through before posting said probability requests if the info already exists and to have a set place to post it if it doesn't.

What do you guys think?

I mean, I don't field questions like that, but I have been a chief contributor in asking them, and more than once asking the same question a year later because I can't find the original.

One thing I have encountered sometimes when I actually do find an old thread where I asked for an anydice/troll formula, is that I'll click the link and it doesn't go to the formula but to the default page. So if this is to be effective the name of the program being linked should be identified and the actual formula should be copied and pasted into the forum post itself.

I don't know what else might be pertinent.


Statistical out-liar
Validated User
So I'm going to go ahead and fill this thread, if for no other reason then to link people to it when they ask the same probability questions that come up once a month.

To start with, chances are the mechanic that you're just discovering or just thought up has already been done by someone (sorry, I know you feel crushed. I do too when I find out something awesome I created has existed for 30 years). At the very least read this: http://www.darkshire.net/jhkim/rpg/systemdesign/dice-motive.html
for a primer is some very common game mechanics and some discussion of their probabilities. It will save you some time asking, give you some insight, and maybe shake out some ideas.


Statistical out-liar
Validated User
To start with dice pools (target number variety). This is when you roll a pool of dice (usually the same but not necessarily) and you count "successes" or "hits" rather than using the numerical values. Usually some set value on the dice counting as success (5 or better on a d6, 4 or better on a d6, 8 or better on a d10 are all common varieties) while others count as failures. The number required to count as a success is often called a target number. Sometimes the target number varies, but this seems to be becoming less common because it's very hard to intuit whether changing a target number or the number of dice is more advantageous. You compare the number of successes rolled to the number required for the specific challenge and if you beat it you have succeeded.

How you model this. This is actually a binomial distribution if you want to do it in excel, I suggest you read the wikipedia page on binomials and use the built in excel functions.

In Anydice, there are several ways to model target number based dice pool systems.

The easiest is to just define a new dice (which will be useful later for fudge dice):

\Put in the number of dice you want for N\
\Change the number of ones to the number of values that count as successes and the number of zeroes to the number of values that count as failures\
output Nd{0,0,0,0,1,1}

You can also use the count function, which seems to be one of its primary purposes. (note this assumes you are counting on the high side as successes)
\N is the number of dice rolled\
\Y is the target number\
\D is the dice size\
\Replace those with the numbers you want to determine the probability of\
output [count {Y..D} in NdD]

If you want to compare the number of dice in the pool you can use the Loop function
\X is the variable that changes, do not put in a number there\
\b is the lowest number of dice\
\B is the highest number of dice in the pool, replace b and B with numbers\
loop X over {b..B} {
output [count {Y..D} in NdD]


Spoiler: Show

In FATE you roll a pool of 4 dice and they count as plus or minus, this isn't really a target number system dice pool but mathematically and Anydice wise it's similar enough to just explain here.

On a Fudge dice there are two -1 sides, two 0 sides, and two +1 sides. You roll 4 and some the results.

Define a fate dice by (note you could also just do three values because the sides repeat, i.e. 2/6 = 1/3}

output d{-1,-1,0,0,1,1}

To get 4 dice, you put the 4 in front of the new dice.

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

Spoiler: Show

In this variant the dice explode on the highest value, (i.e. you can roll dice that come up 6 on a d6 again for the chance to add another success on top of the one you got for a 6, theoretically out to infinity)

\This is set up for shadowrun where 5 and 6 are success and with edge you can reroll 6s\
\The top part is an Anydice function, R represents the values for which the die explodes, N >= 5 is the range for which things count as success\

function: nwod R:n again N:n {
if N >= R { result: 1 + [nwod R again d6] }
result: N >= 5

\This part is setting up the function to act as a dice so that you can loop X dice and have each one potentially explode\

NWOD: [nwod 6 again d6]

loop X over {2..10} {
output XdNWOD named "[X]d"

Spoiler: Show

Sometimes instead of a fixed number of success required, two pools of dice are rolled against one another. This is often what happens when facing an NPC in many games.

For this simply pick on pool to be positive and one to be negative. So a pool with X dice(positive) goes against a pool with Y dice (positive). Here assumed to have a target number of 4 on a d6.

\Put in the size of your dice pools\
output [count {4,5,6} in Xd6] - [count {4,5,6} in Yd6]
\Positive means X had that many more successes than Y, negative means Y had that many more successes than X\
Last edited:


Statistical out-liar
Validated User
Step dice, i.e. using bigger or smaller dice to represent character ability. Seriously read the articles dice mechanics, this is a really well documented system in addition to Earthdawn, Firefly has used as have a lot of other systems.

Mathematically, you just have uniform distributions of varying sizes. Your probability will just be whatever fraction of the numbers on the dice are equal to or greater than the challenge number.

In Anydice
\B is the size of the dice, set it to the size you want\
output dB

If you want to look at how the probabilities change
\X is the looping variable, don't touch X. Change n and N to your maximum and minimum dice or put in the size of each dice you're interested in\
loop X over {2..10} {
output 1dX

The complications come in when people realize that 5 levels with standard dice are not that many levels and they start adding exotic dice (d2, d14, etc.) or they decide to fix things by trying to balance things without exotic dice by adding fixed values or rolling multiple dice.

Adding a fixed value
\Y is your fixed value\
output 1dB+ Y

Rolling multiple dice (1d12 +1d2, 1d12+1d4, etc.)
\Shows each smaller dice added to a d12 and an exotic dice of the same size for comparison\
loop X over {2,4,6,8,10,12} {
output 1d12+1dX
C: X+12
output 1dC


Statistical out-liar
Validated User
Another one that comes up a lot is rolling several dice and only taking the highest value dice. The probability for calculating this can be tricky, but is good for illustrating one of the core things you should know about probability. The probability of something happening is 1-the probability of it not happening. (note, yes there are other ways of calculating this besides the one I'm explaining here)

So let's say you want to know the probability of rolling a given number as the highest dice on a X number of 6 sided dice.

1: The probability of the highest dice being a 1 is the probability that all the dice rolled are 1s (since rolling anything higher would be that number). The probability of rolling a 1 on a dice is 1/6. So the probability of all 1s is (1/6)^(X) power or 1/6 multiplied by itself X times.

2: The probability of the highest dice being a 2 or lower is the probability that all the dice are 2 or lower (2/6 = 1/3) raised to the number of dice. i.e. (1/3)^X
But this includes the probability of the highest dice being 1. Fortunately, we know within the probability of (1/3)^X has only 2 possible outcomes for the highest 1 and 2. So we can subtract the probability of 1 being the highest and be left with the probability that 2 is the highest.
So the probability 2 is the highest is (1/3)^X-(1/6)^X

3: This is the last dice where we really have to think before we just start using the formula. The probability of a dice being 3 or lower is 3/6 or 1/2 (50%) so the probability of all of the dice being 3 or lower is (1/2)^X. But we're not interested in the case where all the dice are 2 or lower, since that yields a highest number of 2 or 1, so we can subtract that out. The probability of 3 being the highest is (1/2)^X-(1/3)^X.
(side note: you can also very quickly find the chance of rolling 4 or better as the highest by subtracting (1/2)^X from 1 since if all the dice are not 3 or lower at least 1 is 4 or higher).

4: Now we just lather rinse repeat. (4/6)^X-(1/2)^X

5: (5/6)^X-(4/6)^X

6: (1)^X-(5/6)^X

You can expand on this if you want to look at the second highest dice or third highest, etc.

Or you could just use Anydice's highest function to pick out the highest dice (note, if you put in {3} or some other number greater than 1 it will sum the highest rather than telling you what they are)

output [highest {1} of Xd6]

Where X is the number of dice rolled.

Rickard Elimää

Searching for a publisher
Validated User
Here are my programs:

Rolling 1dX higher than 1dY
Example: rolling 1d8 higher than 1d6

Rolling 2d10, picking the highest rolled die OR adding the dice together if rolling double.
rolling 2d10 where both comes out as fives gives the final outcome of 10.

Rolling 2d10 in a d100 roll where the player chooses which is tens and which is single.
Rolling 4 and 7 against 60 lets the player choose to pick 47 rather than 74.

Rolling 2d10 against a skill. The lowest die is compared to the skill (equal or lower = success) and the higher one becomes the effect.
Rolling 2 and 7 against value 3 gives 7 in effect.

Rolling 1d20+X higher than 1d12 (very easy), highest of 2d12 (easy), 1d20 (challenging), highest of 1d20 and 1d12 (hard), highest of 2d20 (very hard)
Rolling 1d20+6 to see if it's higher either 1d12 or 1d20 (hard difficulty).

Dice Pools

Subtracting the lowest die from the highest in a pool of similar types of dice
Example: rolling 6d6 and subtracting the lowest rolled die from the highest.

Rolling XdY against a target number and compares it to the game masters pool.
Rolling 4d6 and 4+ is a success, and compares it to the game master's roll of 6d6 vs 4+.

Rolling XdY and removing Z of the highest rolled dice as difficulty.
Rolling 4d6 against a difficulty of 2. Removes the two highest dice after the roll.

Rolling XdY against ZdY and each die that is equal or higher is a success. Botch occurs if all dice are rolling 1.
Rolling 3d10 against 2d10 where rolling three ones is a botch.

Adding the two highest dice of a pool consisting of different die types (hard to do in Anydice)
Rolling 1d4+3d6 and adding the the two highest rolled dice together.

Rolling XdY against AdB and either compare the sums of each pool or how well they roll against a target number.
Rolling 4d6 against 3d8.

Rolling XdY, taking the highest die
Rolling 4d20 and keeps the highest rolled die.

Rolling XdY and taking the highest or adding the same results together.
Rolling 5d10 where 2, 5+5+5, 8 results in 15.
Last edited:

Duck Call Lass

Active member
Adding the two highest dice of a pool consisting of different die types (hard to do in Anydice)
Rolling 1d4+3d6 and adding the the two highest rolled dice together.
The Queen's Cavaliers uses a dice pool system where the highest two rolls of a mixed pool of dice are added together. For testing, I used Troll instead of Anydice to experiment with the probabilities. Here's the Troll script for TQC dice:

\ The Queen's Cavaliers Dice Rolls

\ TQC uses a dice pool system that adds together the two
\ highest dice to get a total to compare, and then uses
\ the lowest of those two dice as the number of success
\ points earned.

A:=0; \ Change to # of d4s in roll
B:=1; \ Change to # of d6s in roll
C:=2; \ Change to # of d8s in roll
E:=1; \ Change to # of d10s in roll
F:=0; \ Change to # of d12s in roll
S:=0; \ Change to 1 to count success points instead of total

sum(least (2 - S) (largest 2 { A d4, B d6, C d8, E d10, F d12} ))
Note: This script is more complex than simply adding up the two highest -- the extra S variable and the least() function are there to count successes generated, which are based on the low die of the two dice kept. You can remove that and use this script instead for just "roll a bunch of dice, keep the 2 highest":

A:=0; \ Change to # of d4s in roll
B:=1; \ Change to # of d6s in roll
C:=2; \ Change to # of d8s in roll
E:=1; \ Change to # of d10s in roll
F:=0; \ Change to # of d12s in roll

sum(largest 2 { A d4, B d6, C d8, E d10, F d12} )
By changing the number of dice in a pool and observing the resulting graph you can see the way that adding or subtracting dice of various sizes affects your expected outcome and the range of outcomes. (The actual math for calculating these types of probabilities is pretty complex.)

Duck Call Lass

Active member
I wrote another script for Troll that will calculate the result of two opposing add-two-highest pools used against each other, and determine how likely it is for one side or the other to be the winner.

The pools used are similar to those in Marvel Heroic Roleplaying, The Queen's Cavaliers, and other games where you roll a bunch of dice, add up the two highest, and compare them against another similar pool result.

\ Opposed Pool Probabilities for The Queen's Cavaliers

\ By Caoimhe Ora Snow (caoimhe@boldpueblo.com)
\ http://queenscavaliers.com/
\ This calculates the chance of success with opposing dice pools.
\ For example, if you are rolling 2d10+1d8+1d6 keep the highest 2
\ (not uncommon in The Queen's Cavaliers) versus a standard difficulty
\ of moderate (3d8 keep 2 highest), what are your chances of success?
\ The answer can be found by subtracting one pool's result from the other.
\ If the result is positive, the acting party succeeds; if the result is
\ negative, the opposing party succeeds. A result of zero means a tie
\ between the two pools, and thus it's up to the rule system to define
\ if that means tie goes to the acting party or the opposing party. You
\ can read the "% >" column to determine what the exact percentage is.
\ As it turns out, the answer to question is that 2d10+1d8+1d6 vs 3d8
\ has a 64.7% chance of going to the acting party, another 8.1% chance
\ of a tie, and a 27.2% of the acting party losing to the standard
\ opposition. If the roll were instead hard (3d10), the odds would be
\ almost exactly even. Try it out!

\ ***********************************************************************

\ Set the acting party here

Ax:=0; \ Change to # of d4s in acting pool
Bx:=1; \ Change to # of d6s in acting pool
Cx:=1; \ Change to # of d8s in acting pool
Ex:=2; \ Change to # of d10s in acting pool
Fx:=0; \ Change to # of d12s in acting pool

\ ***********************************************************************

\ Set the opposing party here. In TQC, standard oppostion is easy (3d6),
\ moderate (3d8), hard (3d10) or very difficult (3d12).
Ay:=0; \ Change to # of d4s in opposing pool
By:=0; \ Change to # of d6s in opposing pool
Cy:=3; \ Change to # of d8s in opposing pool
Ey:=0; \ Change to # of d10s in opposing pool
Fy:=0; \ Change to # of d12s in opposing pool

\ ***********************************************************************
\ Don't change anything below this line. This is where the magic happens.
\ ***********************************************************************

sum(largest 2 { Ax d4, Bx d6, Cx d8, Ex d10, Fx d12} ) - sum(largest 2 { Ay d4, By d6, Cy d8, Ey d10, Fy d12} )
This is saved on Troll as Opposed Pool Probabilities for The Queen's Cavaliers. You can change the results by tweaking that last line -- for example, make it "largest 1" to save only the single highest die from each pool, instead of adding two dice together.
Top Bottom