I need help calculating the probability of rolling $n$ dice with $k$ faces. So you have multiple dice, all with $k$ faces (number of sides on a dice) and you want to calculate the probability of a specific sequence. For example:
The dice has $8$ faces (sides) and $3$ dice have been rolled: Calculate the probability of $4, 2, 8$
I'm writing a program to calculate this so if someone could help me break this down and explain the maths to me it would be greatly appreciated.
A similar question has been answered already.
Count $t$ the total number of outputs if dice could be distinguished : $t = k^n$.
Count $w$ the number of ways to order the specific output that you want. You look for a multiset $\{i_1:m_1, i_2:m_2,\ldots, i_l:m_l\}$ where $i_j$ appears $m_j$ times for $j$ in $\{1,2,\ldots,l\}$ (by the way, $\sum_j m_j = n$). This number is $w = \frac{n!}{\prod_j m_j!}$. Note that $w$ is the number of outputs (with distinguishable dice) that would satisfy your aim.
The probability is then
$$ \frac{w}{t} = \frac{n!}{k^n \prod_j m_j!}.$$
edit : if Guest 86 is right (4,2,8 is different from 4,8,2) then forget about what I wrote, you are looking for $\frac{1}{k^n}$