There is a quite surprising way to sample from the Poisson distribution with any $\lambda$ parameter. The basis for this is the following algorithm to sample a Poisson variate with $\lambda = 1$, which involves only integer arithmetic and no floating-point operations (Duchon and Duvignau, "Preserving the number of cycles of length k in a growing uniform permutation", Electronic Journal of Combinatorics 23(4), 2016):
- Set ret to 1, a to 1, and b to 0.
- Generate $j$, a uniform random integer in [0, a].
- If $j<a$ and $j<b$, return ret.
- If $j=a$, add 1 to ret. Otherwise, subtract 1 from ret and set b to $1+a$.
- Add 1 to a and go to step 1.
Poisson variates with other $\lambda$ parameters follow by splitting $\lambda$ into pieces of size no greater than 1. Then, for each piece, a Poisson variate with $\lambda$ equal to that piece is generated. Then all these variates are added together.
Finally, let $\mu < 1$, then to generate a Poisson variate with parameter $\mu$, it's enough to:
- Generate $N$, a Poisson variate with parameter 1.
- Flip $N$ coins that each show heads with probability $\mu$, then count the number of heads.