lemon/random.h
 changeset 12 435bbc8127b3 parent 11 ea5945b2da9c child 16 22696f89d183
equal inserted replaced
1:248da664e953 2:1bc99a8abfbe
`   796       `
`   796       `
`   797     /// Pareto distribution`
`   797     /// Pareto distribution`
`   798 `
`   798 `
`   799     /// This function generates a Pareto distribution random number.`
`   799     /// This function generates a Pareto distribution random number.`
`   800     /// `
`   800     /// `
`       `
`   801     ///\param k shape parameter (<tt>k>0</tt>)`
`   801     ///\param x_min location parameter (<tt>x_min>0</tt>)`
`   802     ///\param x_min location parameter (<tt>x_min>0</tt>)`
`   802     ///\param k shape parameter (<tt>k>0</tt>)`
`   803     ///`
`   803     ///`
`   804     double pareto(double k,double x_min)`
`   804     ///\warning This function used inverse transform sampling, therefore may`
`   805     {`
`   805     ///suffer from numerical unstability.`
`   806       return exponential(gamma(k,1.0/x_min));`
`   806     ///`
`       `
`   807     ///\todo Implement a numerically stable method`
`       `
`   808     double pareto(double x_min,double k)`
`       `
`   809     {`
`       `
`   810       return x_min*pow(1.0-real<double>(),1.0/k);`
`       `
`   811     }  `
`   807     }  `
`   812       `
`   808       `
`   813     ///@}`
`   809     ///@}`
`   814     `
`   810     `
`   815     ///\name Two dimensional distributions`
`   811     ///\name Two dimensional distributions`