We'll pretend we have k
s
-sided dice and we are trying to find the probability to get n
specific different results. The first die roll we have an n/s
chance of getting a number we need and an (s-n)/s
chance we get a number we don't need. When we get a number we need we are looking to get n-1
numbers we need on k-1
different dice. When we get a number we don't need we are still looking to get n
numbers but with k-1
dice left to roll. The probability of getting n = 0
results is always 1
regardless of the number of dice. The probability of getting any more results when there aren't any dice left (k = 0
) is 0
.
prob s k 0 = 1
prob s 0 n = 0
prob s k n = (n*(prob s (k-1) (n-1)) + (s-n)*(prob s (k-1) n))/s
We can make a table to calculate these for s = 6
sided dice.
0 1 2 3 4 5 6 n
0 1 0 0 0 0 0 0
1 1 1/6 0 0 0 0 0
2 1 11/36 2/36 0 0 0 0
3 1 91/216 30/216 6/216 0 0 0
4 1 671/1296 302/1296 108/1296 24/1296 0 0
.
.
.
k
The problems you are interested in are getting n=2
specific different results with k=2
dice which has a probability of 2/36
, getting n=2
specific different results with k=3
dice, which has a probability of 30/216
, and getting n=3
specific different results with k=4
dice, which has a probability of 108/1296
.
There is probably a simpler non-recursive formula based on the factorial function.
We can check the above formula with counting arguments.
To get a 3 and a 4 rolling 2d6
there's 1
combination of dice that will work. We don't care if we roll the 3 first or the 4 first, so there are 2! = 2*1 = 2
orders we can roll the combination in. 2
of the 6^2
possible rolls result in a 3 and a 4. The probability of rolling a 3 and a 4 on 2d6
is 2/36
or 1/18
.
We can make a table of all the ways to roll a 3 and a 4 on 2
dice and count them to make sure this is correct
3 4 1 way
4 3 1 way
2 ways
2
ways out of 36
roll a 3 and a 4.
There are more ways to roll a 3 and a 4 than there are ways to roll two 3s. Theres' only one way to roll two 3s. If we switch the order we roll the dice in it doesn't add another way to get two 3s. This will matter when we add extra dice.
3 3 1 way
3 3 0 ways! We already counted this.
1 way
Let's write down all the ways we can roll a 3 and a 4 on 3d6
. We'll use *
to denote any result that is neither a 3 or a 4 (there are 4
possible such results: 1, 2, 5, and 6)
3 4 * 4 ways
3 4 3 1 way
3 4 4 1 way
4 3 * 4 ways
4 3 3 1 way
4 3 4 1 way
3 * 4 4 ways
3 3 4 1 way
3 4 4 0 ways! We already counted this.
4 * 3 4 ways
4 3 3 0 ways! We already counted this.
4 4 3 1 way
* 3 4 4 ways
3 3 4 0 ways! We already counted this.
4 3 4 0 ways! We already counted this.
* 4 3 4 ways
3 4 3 0 ways! We already counted this.
4 4 3 0 ways! We already counted this.
30 ways
When one of the results isn't a 3 or 4 it's easy, there's 4
combinations that can be in 3! = 3*2*1 = 6
orders. When all of the results have a 3 or 4 then one of the numbers will be repeated. Instead of having 2
combinations that can be in 3! = 3*2*1 = 6
, half of the orders are duplicates, so there are only 30=6*4+2*3
ways to roll a 3 and a 4. The probability of rolling a 3 and a 4 on 3d6
is therefore 30/6^3
or 5/36
.
Counting results to check larger problems is tedious. This line of thinking is leading to a recursive formula involving factorial which is no simpler than the recursive formula we started with.
The accepted solution disregards the core purpose of the actual question (how does user choice affect the outcome), so I had to try and figure it out...
I'm new to anydice, so I welcome corrections/suggestions.
Here, if the player rolls their desired outcome on 2/3 dice, that becomes their choice, otherwise, output a random choice from the 3....
function: choice of A:n and B:n and C:n target T:n {
if A=T { result: A }
if B=T { result: B }
if C=T { result: C }
result: 1d{A, B, C}
}
function: combo of A:n and B:n and C:n target T {
result: [choice of A+B and B+C and A+C target T]
}
loop T over {1..12} {
output [combo of 1d6 and 1d6 and 1d6 target T] named "2/3d6 [T]"
}
Here, we can see the huge difference that player choice makes
Chance of getting a 7:
2d6: ~17%
(2/3)d6: ~42%
This matches the mathematical answer:
The probability that a pair of the three dice has sum '7' is
$$\frac{3 \cdot 6 \cdot 4 + 3 \cdot 6}{6^3} = \frac{90}{216} = \frac{5}{12} ≈ 42/100 $$
Src: https://math.stackexchange.com/questions/3283971/probability-that-2-dice-selected-from-3-rolled-dice-will-have-sum-7
Best Answer
Here's the link to the program, and here it is in its entirety: