Skip to main content
2 of 2
edited tags
François G. Dorais
  • 44.4k
  • 6
  • 150
  • 233

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?