Further doc improvements
authoralpar
Wed, 07 Feb 2007 18:07:10 +0000
changeset 235657c316cb868b
parent 2355 ac0d843b8873
child 2357 5365600a7a5c
Further doc improvements
lemon/random.h
     1.1 --- a/lemon/random.h	Tue Feb 06 19:16:26 2007 +0000
     1.2 +++ b/lemon/random.h	Wed Feb 07 18:07:10 2007 +0000
     1.3 @@ -624,6 +624,11 @@
     1.4        return _random_bits::BoolConversion<Word>::convert(core);
     1.5      }
     1.6  
     1.7 +    ///\name Nonuniform distributions
     1.8 +    ///
     1.9 +    
    1.10 +    ///@{
    1.11 +    
    1.12      /// \brief Returns a random bool
    1.13      ///
    1.14      /// It returns a random bool with given probability of true result
    1.15 @@ -634,9 +639,9 @@
    1.16      /// Standard Gauss distribution
    1.17  
    1.18      /// Standard Gauss distribution.
    1.19 -    /// \todo Currently it uses the so-calles "polar technique" to generate
    1.20 -    /// random distribution.
    1.21 -    /// Probably, the "Ziggurat" method should rather be used.
    1.22 +    /// \note The Cartesian form of the Box-Muller
    1.23 +    /// transformation is used to generate a random normal distribution.
    1.24 +    /// \todo Consider using the "ziggurat" method instead.
    1.25      double gauss() 
    1.26      {
    1.27        double V1,V2,S;
    1.28 @@ -647,21 +652,34 @@
    1.29        } while(S>=1);
    1.30        return std::sqrt(-2*std::log(S)/S)*V1;
    1.31      }
    1.32 -    /// Gauss distribution with given variance and mean 0
    1.33 -    double gauss(double var) 
    1.34 +    /// Gauss distribution with given standard deviation and mean 0
    1.35 +
    1.36 +    /// \sa gauss()
    1.37 +    ///
    1.38 +    double gauss(double std_dev) 
    1.39      {
    1.40 -      return gauss()*var;
    1.41 +      return gauss()*std_dev;
    1.42      }
    1.43 -    /// Gauss distribution with given variance and mean
    1.44 -    double gauss(double var,double mean)
    1.45 +    /// Gauss distribution with given mean and standard deviation
    1.46 +
    1.47 +    /// \sa gauss()
    1.48 +    ///
    1.49 +    double gauss(double mean,double std_dev)
    1.50      {
    1.51 -      return gauss()*var+mean;
    1.52 +      return gauss()*std_dev+mean;
    1.53      }
    1.54  
    1.55 -    double exponential(double lambda)
    1.56 +    /// Exponential distribution with given mean
    1.57 +
    1.58 +    /// This function generates an exponential distribution random number
    1.59 +    /// with mean <tt>1/lambda</tt>.
    1.60 +    ///
    1.61 +    double exponential(double lambda=1.0)
    1.62      {
    1.63        return -log(real<double>())/lambda;
    1.64      }
    1.65 +
    1.66 +    ///@}
    1.67      
    1.68    };
    1.69