Serious buxfixes in Random::gamma() and Random::pareto()
authorAlpar Juttner <alpar@cs.elte.hu>
Thu, 03 Apr 2008 13:00:18 +0100
changeset 116b6bede534255
parent 115 7b44eea654d0
child 117 7b0ce9fb1169
child 123 8899d1891a3c
Serious buxfixes in Random::gamma() and Random::pareto()
lemon/random.h
     1.1 --- a/lemon/random.h	Tue Apr 01 16:25:51 2008 +0100
     1.2 +++ b/lemon/random.h	Thu Apr 03 13:00:18 2008 +0100
     1.3 @@ -795,7 +795,7 @@
     1.4  	    nu=V0*std::exp(-xi);
     1.5  	  }
     1.6        } while(nu>std::pow(xi,delta-1.0)*std::exp(-xi));
     1.7 -      return theta*(xi-gamma(int(std::floor(k))));
     1.8 +      return theta*(xi+gamma(int(std::floor(k))));
     1.9      }
    1.10      
    1.11      /// Weibull distribution
    1.12 @@ -819,7 +819,7 @@
    1.13      ///
    1.14      double pareto(double k,double x_min)
    1.15      {
    1.16 -      return exponential(gamma(k,1.0/x_min));
    1.17 +      return exponential(gamma(k,1.0/x_min))+x_min;
    1.18      }  
    1.19        
    1.20      /// Poisson distribution