COIN-OR::LEMON - Graph Library

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/random.h

    r340 r280  
    541541    /// @{
    542542
     543    ///\name Initialization
     544    ///
     545    /// @{
     546
    543547    /// \brief Default constructor
    544548    ///
     
    705709    }
    706710
     711    /// @}
     712
     713    ///\name Uniform distributions
     714    ///
     715    /// @{
     716
    707717    /// \brief Returns a random real number from the range [0, 1)
    708718    ///
     
    761771      return _random_bits::IntConversion<Number, Word>::convert(core);
    762772    }
     773
     774    /// @}
    763775
    764776    unsigned int uinteger() {
     
    795807    ///\name Non-uniform distributions
    796808    ///
     809
    797810    ///@{
    798811
    799     /// \brief Returns a random bool with given probability of true result.
     812    /// \brief Returns a random bool
    800813    ///
    801814    /// It returns a random bool with given probability of true result.
     
    804817    }
    805818
    806     /// Standard normal (Gauss) distribution
    807 
    808     /// Standard normal (Gauss) distribution.
     819    /// Standard Gauss distribution
     820
     821    /// Standard Gauss distribution.
    809822    /// \note The Cartesian form of the Box-Muller
    810823    /// transformation is used to generate a random normal distribution.
     
    819832      return std::sqrt(-2*std::log(S)/S)*V1;
    820833    }
    821     /// Normal (Gauss) distribution with given mean and standard deviation
    822 
    823     /// Normal (Gauss) distribution with given mean and standard deviation.
     834    /// Gauss distribution with given mean and standard deviation
     835
     836    /// Gauss distribution with given mean and standard deviation.
    824837    /// \sa gauss()
    825838    double gauss(double mean,double std_dev)
    826839    {
    827840      return gauss()*std_dev+mean;
    828     }
    829 
    830     /// Lognormal distribution
    831 
    832     /// Lognormal distribution. The parameters are the mean and the standard
    833     /// deviation of <tt>exp(X)</tt>.
    834     ///
    835     double lognormal(double n_mean,double n_std_dev)
    836     {
    837       return std::exp(gauss(n_mean,n_std_dev));
    838     }
    839     /// Lognormal distribution
    840 
    841     /// Lognormal distribution. The parameter is an <tt>std::pair</tt> of
    842     /// the mean and the standard deviation of <tt>exp(X)</tt>.
    843     ///
    844     double lognormal(const std::pair<double,double> &params)
    845     {
    846       return std::exp(gauss(params.first,params.second));
    847     }
    848     /// Compute the lognormal parameters from mean and standard deviation
    849 
    850     /// This function computes the lognormal parameters from mean and
    851     /// standard deviation. The return value can direcly be passed to
    852     /// lognormal().
    853     std::pair<double,double> lognormalParamsFromMD(double mean,
    854                                                    double std_dev)
    855     {
    856       double fr=std_dev/mean;
    857       fr*=fr;
    858       double lg=std::log(1+fr);
    859       return std::pair<double,double>(std::log(mean)-lg/2.0,std::sqrt(lg));
    860     }
    861     /// Lognormal distribution with given mean and standard deviation
    862 
    863     /// Lognormal distribution with given mean and standard deviation.
    864     ///
    865     double lognormalMD(double mean,double std_dev)
    866     {
    867       return lognormal(lognormalParamsFromMD(mean,std_dev));
    868841    }
    869842
     
    971944    ///\name Two dimensional distributions
    972945    ///
     946
    973947    ///@{
    974948
     
    987961      return dim2::Point<double>(V1,V2);
    988962    }
    989     /// A kind of two dimensional normal (Gauss) distribution
     963    /// A kind of two dimensional Gauss distribution
    990964
    991965    /// This function provides a turning symmetric two-dimensional distribution.
Note: See TracChangeset for help on using the changeset viewer.