I am writing a simulator in which I am generating a flow of particle. I want this flow to follow a Poisson process, i.e. $\lambda$ particles are generated per second on average. So how to compute the time of the next particle generation? i.e. how to write the POI function below?
t = POI(lambda) while true: if time_now() >= t: generate_a_particle() t = t + POI(lambda)
According to this post (http://math.stackexchange.com/questions/18894/exponential-distribution-from-poisson), I think I should draw a random number $u$ from the $[0,\lambda]$ interval, and compute t so that $f_X(t)=u$, which gives $ t=\frac{Ln(\lambda/u)}{\lambda} $
That would make POI be:
POI(lambda): u = random(0,lambda) return ln(lambda/u)/lambda
Is that correct?