lemon/random.h
changeset 340 0badf3bb38c2
parent 339 2593e163e407
child 378 80ec623f529f
     1.1 --- a/lemon/random.h	Thu Jun 19 17:33:06 2008 +0100
     1.2 +++ b/lemon/random.h	Tue Oct 28 14:47:57 2008 +0100
     1.3 @@ -540,10 +540,6 @@
     1.4      ///
     1.5      /// @{
     1.6  
     1.7 -    ///\name Initialization
     1.8 -    ///
     1.9 -    /// @{
    1.10 -
    1.11      /// \brief Default constructor
    1.12      ///
    1.13      /// Constructor with constant seeding.
    1.14 @@ -708,12 +704,6 @@
    1.15        return real<Number>() * (b - a) + a;
    1.16      }
    1.17  
    1.18 -    /// @}
    1.19 -
    1.20 -    ///\name Uniform distributions
    1.21 -    ///
    1.22 -    /// @{
    1.23 -
    1.24      /// \brief Returns a random real number from the range [0, 1)
    1.25      ///
    1.26      /// It returns a random double from the range [0, 1).
    1.27 @@ -771,8 +761,6 @@
    1.28        return _random_bits::IntConversion<Number, Word>::convert(core);
    1.29      }
    1.30  
    1.31 -    /// @}
    1.32 -
    1.33      unsigned int uinteger() {
    1.34        return uinteger<unsigned int>();
    1.35      }
    1.36 @@ -806,19 +794,18 @@
    1.37  
    1.38      ///\name Non-uniform distributions
    1.39      ///
    1.40 -
    1.41      ///@{
    1.42  
    1.43 -    /// \brief Returns a random bool
    1.44 +    /// \brief Returns a random bool with given probability of true result.
    1.45      ///
    1.46      /// It returns a random bool with given probability of true result.
    1.47      bool boolean(double p) {
    1.48        return operator()() < p;
    1.49      }
    1.50  
    1.51 -    /// Standard Gauss distribution
    1.52 +    /// Standard normal (Gauss) distribution
    1.53  
    1.54 -    /// Standard Gauss distribution.
    1.55 +    /// Standard normal (Gauss) distribution.
    1.56      /// \note The Cartesian form of the Box-Muller
    1.57      /// transformation is used to generate a random normal distribution.
    1.58      double gauss()
    1.59 @@ -831,9 +818,9 @@
    1.60        } while(S>=1);
    1.61        return std::sqrt(-2*std::log(S)/S)*V1;
    1.62      }
    1.63 -    /// Gauss distribution with given mean and standard deviation
    1.64 +    /// Normal (Gauss) distribution with given mean and standard deviation
    1.65  
    1.66 -    /// Gauss distribution with given mean and standard deviation.
    1.67 +    /// Normal (Gauss) distribution with given mean and standard deviation.
    1.68      /// \sa gauss()
    1.69      double gauss(double mean,double std_dev)
    1.70      {
    1.71 @@ -864,7 +851,7 @@
    1.72      /// standard deviation. The return value can direcly be passed to
    1.73      /// lognormal().
    1.74      std::pair<double,double> lognormalParamsFromMD(double mean,
    1.75 -						   double std_dev)
    1.76 +                                                   double std_dev)
    1.77      {
    1.78        double fr=std_dev/mean;
    1.79        fr*=fr;
    1.80 @@ -872,14 +859,14 @@
    1.81        return std::pair<double,double>(std::log(mean)-lg/2.0,std::sqrt(lg));
    1.82      }
    1.83      /// Lognormal distribution with given mean and standard deviation
    1.84 -    
    1.85 +
    1.86      /// Lognormal distribution with given mean and standard deviation.
    1.87      ///
    1.88      double lognormalMD(double mean,double std_dev)
    1.89      {
    1.90        return lognormal(lognormalParamsFromMD(mean,std_dev));
    1.91      }
    1.92 -    
    1.93 +
    1.94      /// Exponential distribution with given mean
    1.95  
    1.96      /// This function generates an exponential distribution random number
    1.97 @@ -983,7 +970,6 @@
    1.98  
    1.99      ///\name Two dimensional distributions
   1.100      ///
   1.101 -
   1.102      ///@{
   1.103  
   1.104      /// Uniform distribution on the full unit circle
   1.105 @@ -1000,7 +986,7 @@
   1.106        } while(V1*V1+V2*V2>=1);
   1.107        return dim2::Point<double>(V1,V2);
   1.108      }
   1.109 -    /// A kind of two dimensional Gauss distribution
   1.110 +    /// A kind of two dimensional normal (Gauss) distribution
   1.111  
   1.112      /// This function provides a turning symmetric two-dimensional distribution.
   1.113      /// Both coordinates are of standard normal distribution, but they are not