lemon/random.h
changeset 23 0ba375bf5dae
parent 16 22696f89d183
child 39 0a01d811071f
equal deleted inserted replaced
3:0edc76e019af 4:9ed4e2bcd930
   694     
   694     
   695     ///@{
   695     ///@{
   696     
   696     
   697     /// \brief Returns a random bool
   697     /// \brief Returns a random bool
   698     ///
   698     ///
   699     /// It returns a random bool with given probability of true result
   699     /// It returns a random bool with given probability of true result.
   700     bool boolean(double p) {
   700     bool boolean(double p) {
   701       return operator()() < p;
   701       return operator()() < p;
   702     }
   702     }
   703 
   703 
   704     /// Standard Gauss distribution
   704     /// Standard Gauss distribution
   717       } while(S>=1);
   717       } while(S>=1);
   718       return std::sqrt(-2*std::log(S)/S)*V1;
   718       return std::sqrt(-2*std::log(S)/S)*V1;
   719     }
   719     }
   720     /// Gauss distribution with given mean and standard deviation
   720     /// Gauss distribution with given mean and standard deviation
   721 
   721 
   722     /// Gauss distribution with given mean and standard deviation
   722     /// Gauss distribution with given mean and standard deviation.
   723     /// \sa gauss()
   723     /// \sa gauss()
   724     double gauss(double mean,double std_dev)
   724     double gauss(double mean,double std_dev)
   725     {
   725     {
   726       return gauss()*std_dev+mean;
   726       return gauss()*std_dev+mean;
   727     }
   727     }
   807     ///\name Two dimensional distributions
   807     ///\name Two dimensional distributions
   808     ///
   808     ///
   809 
   809 
   810     ///@{
   810     ///@{
   811     
   811     
   812     /// Uniform distribution on the full unit circle.
   812     /// Uniform distribution on the full unit circle
   813 
   813 
   814     /// Uniform distribution on the full unit circle.
   814     /// Uniform distribution on the full unit circle.
   815     ///
   815     ///
   816     dim2::Point<double> disc() 
   816     dim2::Point<double> disc() 
   817     {
   817     {