Sum of random coin flips

1.4k Views Asked by At

Let x be a variable. Lets say I have a coin and I flip it n times. If it lands on tails, I add one to x. Given a source of uniformly distributed numbers (0 to 1), how map it to a number between 0 and n so that the distribution of the random numbers is the same as the distribution of x? Also, please provide a more general way to do this for a biased coin, with probability of tails being t.

1

There are 1 best solutions below

0
On

Your variable $x$ is distributed according to the binomial distribution with parameters $n$ and $t$.

Take a look at the generating binomial random variates section to find how to transform a uniformly distributed random number to your variable $x$.