Gamma distribution. (Not the gamma function!) Conditions on the parameters are alpha > 0 and beta > 0.
random.gammavariate(alpha, beta)
x ** (alpha - 1) * math.exp(-x / beta) pdf(x) = -------------------------------------- math.gamma(alpha) * beta ** alpha