Solution (source code)

= Solution

Under <complete randomization>, every assignment vector with exactly $n_z$ patients receiving treatment $z$ is equally likely. Thus, for $z=(z_1,\ldots,z_n)$ and $N_r(z)=\sum_i\mathbf1_{\{z_i=r\}}$,
$$
\mathbb P(Z=z)=
\begin{cases}
\dfrac{n_0!n_1!n_2!}{n!},&N_r(z)=n_r\quad(r=0,1,2),\\
0,&\text{otherwise}.
\end{cases}
$$
The reciprocal probability $n!/(n_0!n_1!n_2!)$ is the <multinomial coefficient> counting assignments with those arm sizes.