Skip to main content
Source Link

Algorithm to produce random number with a gamma distribution

I'd like to produce pseudo-random numbers with different distributions for a Monte Carlo simulation.

I've got the poisson distribution working nicely with an algorithm from Knuth. I'm having trouble getting a nice easy and fast algorithm for a power distribution. The gamma distribution should do, but the article in wikipaedia gives an algorithm, but remarks that it's not a good one, without providing a link to a better one.

http://en.wikipedia.org/wiki/Gamma_distribution#Generating_gamma-distributed_random_variables

Is there a good, fast algorithm for a gamma distribution?