Correctly simulating a Poisson process at population level

20 Views Asked by At

I have a string sequence that undergoes random mutation per position with $P_{mutate}=0.001$. So to determine mutation of a specific position I can use the following, where $x$ is a uniformly distributed random variable in the range $[0,1]$:

$x \leq P_{mutate}$

As I would rather than generate random numbers per string element, I would like to calculate first the number of positions that will undergo mutation given $P_{mutate}$ and the sequence length. To do this, I reckon that (where $n$ is the number of mutated positions and $l$ is the sequence length):

$n = \lfloor\frac{P_{mutate}\cdot l}{x}\rfloor$

But this is clearly wrong, as the result is completely different. I am looking for a computationally simple solution that avoids generating random variables per position.