# HG changeset patch # User Alpar Juttner # Date 2008-04-03 14:00:18 # Node ID b6bede534255e492871c601771442b65e12f7319 # Parent 7b44eea654d0ae8a9fe5be301d1bf74ef7edb56e Serious buxfixes in Random::gamma() and Random::pareto() diff --git a/lemon/random.h b/lemon/random.h --- a/lemon/random.h +++ b/lemon/random.h @@ -795,7 +795,7 @@ nu=V0*std::exp(-xi); } } while(nu>std::pow(xi,delta-1.0)*std::exp(-xi)); - return theta*(xi-gamma(int(std::floor(k)))); + return theta*(xi+gamma(int(std::floor(k)))); } /// Weibull distribution @@ -819,7 +819,7 @@ /// double pareto(double k,double x_min) { - return exponential(gamma(k,1.0/x_min)); + return exponential(gamma(k,1.0/x_min))+x_min; } /// Poisson distribution