Formula to get mean and standard deviation of this multi-variable equation $$
\binom n x \times\left(\frac1r\right)^x\times\left(\frac{r-1}r\right)^{n-x}
$$
If you have $n$ boxes and have a $\frac1r$ chance to fill each one, this equation returns the chance that you fill exactly $x$ boxes. When $n$ and $r$ are given, the graph is a normal distribution.
I read about the Box-Muller algorithm to generate random normally distributed numbers, but I need the mean and standard deviation of the bell curve given $n$ and $r$.
I've been working for a while to try to make a formula for it, but to no avail. Help would be very welcome.
 A: The distribution is not a normal distribution, it is a binomial distribution. But for large $N$ the normal distribution is an excellent approximation to the binomial distribution.
At any rate, the exact answer for the binomial distribution is that the mean is $\frac{n}{r}$ and the standard deviation is 
$$
\sqrt{npq} = \sqrt{n \frac{1}{r} \frac{r-1}{r}} = \frac{1}{r} \sqrt{n(r-1)}$$ 
A: Let $X_i$ be the random variable which equals $1$ when box $i$ is filled, and $0$ otherwise. Then the variable you want to know about is $X = \sum_{i = 1}^{n}X_i$.
We have:
$$E(X) = E(\sum_{i = 1}^{n}X_i) = \sum_{i = 1}^{n}E(X_i)$$
And, since the $X_i$ are independent:
$$\sigma^{2} = Var(X) = Var(\sum_{i = 1}^{n}X_i) = \sum_{i = 1}^{n}Var(X_i)$$
Since $X_i$ is $1$ with probability $1/r$ and $0$ with probability $1 - 1/r$, $E(X_i) = 1/r$. So your mean is:
$$E(X) = \sum_{i = 1}^{n}\frac{1}{r} = \frac{n}{r}$$
Similarly, the variance of $X_i$ is $(1 - 1/r)(1/r)$, so:
$$Var(X) = \sum_{i = 1}^{n}\left(1 - \frac{1}{r}\right)\frac{1}{r} = n\frac{1 - r}{r^2}$$
And so $\sigma = \frac{1}{r}\sqrt{n(1-r)}$
