author | Alpar Juttner <alpar@cs.elte.hu> |
Sat, 22 Dec 2007 07:01:20 +0000 | |
changeset 12 | 435bbc8127b3 |
parent 11 | ea5945b2da9c |
child 13 | 83c84df7a956 |
child 14 | 8685efdef52f |
lemon/random.h | file | annotate | diff | comparison | revisions |
1.1 --- a/lemon/random.h Fri Dec 21 01:32:24 2007 +0000 1.2 +++ b/lemon/random.h Sat Dec 22 07:01:20 2007 +0000 1.3 @@ -798,16 +798,12 @@ 1.4 1.5 /// This function generates a Pareto distribution random number. 1.6 /// 1.7 + ///\param k shape parameter (<tt>k>0</tt>) 1.8 ///\param x_min location parameter (<tt>x_min>0</tt>) 1.9 - ///\param k shape parameter (<tt>k>0</tt>) 1.10 /// 1.11 - ///\warning This function used inverse transform sampling, therefore may 1.12 - ///suffer from numerical unstability. 1.13 - /// 1.14 - ///\todo Implement a numerically stable method 1.15 - double pareto(double x_min,double k) 1.16 + double pareto(double k,double x_min) 1.17 { 1.18 - return x_min*pow(1.0-real<double>(),1.0/k); 1.19 + return exponential(gamma(k,1.0/x_min)); 1.20 } 1.21 1.22 ///@}