COIN-OR::LEMON - Graph Library

Changeset 2356:57c316cb868b in lemon-0.x


Ignore:
Timestamp:
02/07/07 19:07:10 (17 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3156
Message:

Further doc improvements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/random.h

    r2355 r2356  
    625625    }
    626626
     627    ///\name Nonuniform distributions
     628    ///
     629   
     630    ///@{
     631   
    627632    /// \brief Returns a random bool
    628633    ///
     
    635640
    636641    /// Standard Gauss distribution.
    637     /// \todo Currently it uses the so-calles "polar technique" to generate
    638     /// random distribution.
    639     /// Probably, the "Ziggurat" method should rather be used.
     642    /// \note The Cartesian form of the Box-Muller
     643    /// transformation is used to generate a random normal distribution.
     644    /// \todo Consider using the "ziggurat" method instead.
    640645    double gauss()
    641646    {
     
    648653      return std::sqrt(-2*std::log(S)/S)*V1;
    649654    }
    650     /// Gauss distribution with given variance and mean 0
    651     double gauss(double var)
     655    /// Gauss distribution with given standard deviation and mean 0
     656
     657    /// \sa gauss()
     658    ///
     659    double gauss(double std_dev)
    652660    {
    653       return gauss()*var;
    654     }
    655     /// Gauss distribution with given variance and mean
    656     double gauss(double var,double mean)
     661      return gauss()*std_dev;
     662    }
     663    /// Gauss distribution with given mean and standard deviation
     664
     665    /// \sa gauss()
     666    ///
     667    double gauss(double mean,double std_dev)
    657668    {
    658       return gauss()*var+mean;
    659     }
    660 
    661     double exponential(double lambda)
     669      return gauss()*std_dev+mean;
     670    }
     671
     672    /// Exponential distribution with given mean
     673
     674    /// This function generates an exponential distribution random number
     675    /// with mean <tt>1/lambda</tt>.
     676    ///
     677    double exponential(double lambda=1.0)
    662678    {
    663679      return -log(real<double>())/lambda;
    664680    }
     681
     682    ///@}
    665683   
    666684  };
Note: See TracChangeset for help on using the changeset viewer.