# HG changeset patch
# User Alpar Juttner <alpar@cs.elte.hu>
# Date 1198306880 0
# Node ID 435bbc8127b3b6076ae41452a059be72c739125b
# Parent  ea5945b2da9c0b92a55d0b8e41c58c838842d8cc
A better way of generating pareto distr, and swap its parameters.

- Pareto distribution is now generated as a composition of a Gamma and
  an exponential one
- Similarly to gamma() and weibull(), the shape parameter became the first one.

diff -r ea5945b2da9c -r 435bbc8127b3 lemon/random.h
--- a/lemon/random.h	Fri Dec 21 01:32:24 2007 +0000
+++ b/lemon/random.h	Sat Dec 22 07:01:20 2007 +0000
@@ -798,16 +798,12 @@
 
     /// This function generates a Pareto distribution random number.
     /// 
+    ///\param k shape parameter (<tt>k>0</tt>)
     ///\param x_min location parameter (<tt>x_min>0</tt>)
-    ///\param k shape parameter (<tt>k>0</tt>)
     ///
-    ///\warning This function used inverse transform sampling, therefore may
-    ///suffer from numerical unstability.
-    ///
-    ///\todo Implement a numerically stable method
-    double pareto(double x_min,double k)
+    double pareto(double k,double x_min)
     {
-      return x_min*pow(1.0-real<double>(),1.0/k);
+      return exponential(gamma(k,1.0/x_min));
     }  
       
     ///@}