Even though I don't quite understand why and how this works, I appreciate how simple it is to generate a set of numbers which are Poisson distributed:
public static int getPoisson(double lambda) {
double l = Math.exp(-lambda);
double p = 1.0;
int k = 0;
do {
k++;
p *= Math.random();
} while (p > l);
return k - 1;
}
This "generating" function is basically from this book were I also find generating functions for the binomial and the geometric distribution.
But I did not find a simple generating function for the log-normal distribution. Either the author calls this distribution the "logarithmic series distribution" (then the generating function would not be simple), or it is missing. In the latter case I am looking for some pseudo-code.