[Lemon-commits] alpar: r3156 - hugo/trunk/lemon

Lemon SVN svn at lemon.cs.elte.hu
Wed Feb 7 19:07:10 CET 2007


Author: alpar
Date: Wed Feb  7 19:07:10 2007
New Revision: 3156

Modified:
   hugo/trunk/lemon/random.h

Log:
Further doc improvements

Modified: hugo/trunk/lemon/random.h
==============================================================================
--- hugo/trunk/lemon/random.h	(original)
+++ hugo/trunk/lemon/random.h	Wed Feb  7 19:07:10 2007
@@ -624,6 +624,11 @@
       return _random_bits::BoolConversion<Word>::convert(core);
     }
 
+    ///\name Nonuniform distributions
+    ///
+    
+    ///@{
+    
     /// \brief Returns a random bool
     ///
     /// It returns a random bool with given probability of true result
@@ -634,9 +639,9 @@
     /// Standard Gauss distribution
 
     /// Standard Gauss distribution.
-    /// \todo Currently it uses the so-calles "polar technique" to generate
-    /// random distribution.
-    /// Probably, the "Ziggurat" method should rather be used.
+    /// \note The Cartesian form of the Box-Muller
+    /// transformation is used to generate a random normal distribution.
+    /// \todo Consider using the "ziggurat" method instead.
     double gauss() 
     {
       double V1,V2,S;
@@ -647,21 +652,34 @@
       } while(S>=1);
       return std::sqrt(-2*std::log(S)/S)*V1;
     }
-    /// Gauss distribution with given variance and mean 0
-    double gauss(double var) 
+    /// Gauss distribution with given standard deviation and mean 0
+
+    /// \sa gauss()
+    ///
+    double gauss(double std_dev) 
     {
-      return gauss()*var;
+      return gauss()*std_dev;
     }
-    /// Gauss distribution with given variance and mean
-    double gauss(double var,double mean)
+    /// Gauss distribution with given mean and standard deviation
+
+    /// \sa gauss()
+    ///
+    double gauss(double mean,double std_dev)
     {
-      return gauss()*var+mean;
+      return gauss()*std_dev+mean;
     }
 
-    double exponential(double lambda)
+    /// Exponential distribution with given mean
+
+    /// This function generates an exponential distribution random number
+    /// with mean <tt>1/lambda</tt>.
+    ///
+    double exponential(double lambda=1.0)
     {
       return -log(real<double>())/lambda;
     }
+
+    ///@}
     
   };
 



More information about the Lemon-commits mailing list