$n$ draws with replacement, $n$ unique balls but $f_0$ are equal to $0$, $f_1$ are equal to $1$, and $f_2$ are equal to $2$ I have been looking for several days now how to correctly do the combinatrics of this specific problem (which ends up being very useful for a bootstrapping application of mine).
Here is how it goes:

*

*There are $n$ unique balls, each labeled with $0$, $1$, or $2$. Among the $n$ balls, $f_0$ balls are labeled with $0$, $f_1$ balls are labeled with $1$, and $f_2$ balls are labeled with $2$,

*I perform $n$ draws with replacement, and the order of the balls I picked does not matter.

In practice, that means if I have two different balls that are equal to $0$ (let's denote them $0_a$ and $0_b$), one equal to $1$ and one equal to $2$, then $n = 4$ and:
$0_a 0_a 0_a 0_a$ is different from $0_a 0_b 0_a 0_a$ but $0_a 0_b 0_a 0_a$ is the same as $0_a 0_a 0_b 0_a$.
Let $M$ denote the mean of the sum of the labels. I'm looking for the distribution of $M$.
$$\begin{align}
    \forall k \in \{0, ..., 2*n\}, \;\; \mathbb{P}\left(M = \dfrac{k}{2*n}\right) & = \dfrac{get_k}{total} \\
    \text{where } get_k & = \sum_{i = 0}^{\lfloor k/2 \rfloor} \dfrac{f_0^{(n-k+i)}}{(n-k+i)!}*\dfrac{f_1^{(k - 2i)}}{(k-2i)!}*\dfrac{f_2^i}{i!}\\
    total & = \binom{2n-1}{n}
\end{align}$$
where when $n-k+i < 0$, the term in the sum of $get_k$ is set to $0$ (happens when we want $k > n$ and we do not consider enough samples with value $2$).
I am pretty confident the formula for total is correct (total number of different draws that can happen - here it does not matter what value are on the balls) because this is "textbook" but i'm pretty sure the $get_k$ formula isn't correct as when I sum it all ($get_k/total$) on Python it doesn't equal to $1$.
I hope i've described the problem quite clearly. I've come up with at least $10$ different formulas for each and I feel like I'm just going circles and I might end up crazy anytime soon.
Thanks!
PS : hopefully if I draw $k < n$ balls with replacement, it doesn't get MUCH harder. I'd be interested in this after I solve this.
 A: If you draw $\ k\ $ balls with replacement, then the numbers, $\ N_0, N_1, N_2\ $, of balls drawn with labels $0$, $1$, and $\ 2\ $ respectively, follow a trinomial distribution:
$$
\mathbb{P}\big(N_0=n_0,N_1=n_1,N_2=n_2\big)={k\choose n_0\,n_1\,n_2}\frac{f_0^{n_0}f_1^{n_1} f_2^{n_2}}{n^k}
$$
if $\ n_0+n_1+n_2=k\ $, where
$$
{k\choose n_0\,n_1\,n_2}=\frac{k!}{n_0!n_1!n_2!}
$$
is the trinomial coefficient.  If $\ n_0+n_1+n_2\ne k\ $, of course, then $\ \mathbb{P}\big(N_0=n_0,N_1=n_1,N_2=n_2\big)=0\ $. The mean of the sum of the labels on the balls drawn is $\ M=\frac{N_1+2N_2}{k}\ $, so what you want is the distribution of this random variable:
$$
\mathbb{P}(M=x)= \mathbb{P}\big(N_1+2N_2=kx\big)\ .
$$
This probability will be zero unless $\ x=\frac{t}{k}\ $ for some $\ t=0,1,\dots,2k\ $, and there are $\ \left\lfloor\frac{t}{2}\right\rfloor-\max(0,t-k)+1\ $
mutually exclusive ways in which that value could be achieved—namely, for $\ i=\max(0,t-k),\dots,\left\lfloor\frac{t}{2}\right\rfloor\ $,
\begin{align}
n_2&=i\\
n_1&=t-2i\ \text{, and}\\
n_0&=k+i-t\ ,
\end{align}
which has a probability
$$
{k\choose k+i-t\ t-2i\ i}\frac{f_0^{k+i-t}f_1^{t-2i}f_2^i}{n^k}
$$
of occurring.  Adding all these up, we get
$$
\mathbb{P}\left(M=\frac{t}{k}\right)=\sum_{i={\max(0,t-k)}}^{\left\lfloor\frac{t}{2}\right\rfloor} {k\choose k+i-t\ t-2i\ i}\frac{f_0^{k+i-t}f_1^{t-2i}f_2^i}{n^k}\ .
$$
