0
$\begingroup$

Say I have a weighted random number generator, which generates discrete numbers in a range with a known probability - for example, it generates 1 25% of the time, and 0 the rest.

How do I calculate the odds that I will see k 1's, where k is in the range [a,b], after observing n randomly generated numbers?

$\endgroup$
  • $\begingroup$ Depends a lot on your distribution. You hint that it is fully discrete. What are the possible outcomes? $\endgroup$ – jameselmore Mar 17 '15 at 21:23
  • $\begingroup$ i'm not sure what you mean - it's discrete in the sense of it generates only the values 0,1; the expected outcome is the ability to generate a sentence along the lines of: "The odds of seeing anywhere between 200 and 300 1s after observing 1000 randomly generated number are 60%" $\endgroup$ – blueberryfields Mar 17 '15 at 22:06
2
$\begingroup$

Let's call the event of your random number being in the given range a "success". If the random numbers are independent and the probability of success is $p$, then the number $X$ of successes in $n$ trials has a binomial distribution with parameters $n$ and $p$. In particular, $\mathbb P(X=k) = {n \choose k} p^k (1-p)^{n-k}$.

$\endgroup$
1
$\begingroup$

If you want to do calculations by hand (i.e., using look up tables) instead of adding up a bunch of binomial distribution terms, then calculate the mean and variance of your binomial and then approximate as a Gaussian with the same mean and variance.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.