COIN-OR::LEMON - Graph Library

Ticket #173: c4aa9f097ef1.patch

File c4aa9f097ef1.patch, 1.7 KB (added by Alpar Juttner, 13 years ago)
  • lemon/random.h

    # HG changeset patch
    # User Alpar Juttner <alpar@cs.elte.hu>
    # Date 1226398357 0
    # Node ID c4aa9f097ef103efaace0da886a07331ba7c8ddf
    # Parent  6dbd5184c6a99e936a7de899e64c114e30c0f94f
    Bugfix in Random (#173)
    
    - operator()s always return a double now
    - the faulty real<Num>(Num) and real<Num>(Num,Num) have been removed
    
    diff --git a/lemon/random.h b/lemon/random.h
    a b  
    692692      return real<double>();
    693693    }
    694694
    695     /// \brief Returns a random real number the range [0, b)
    696     ///
    697     /// It returns a random real number from the range [0, b).
    698     template <typename Number>
    699     Number real(Number b) {
    700       return real<Number>() * b;
    701     }
    702 
    703     /// \brief Returns a random real number from the range [a, b)
    704     ///
    705     /// It returns a random real number from the range [a, b).
    706     template <typename Number>
    707     Number real(Number a, Number b) {
    708       return real<Number>() * (b - a) + a;
    709     }
    710 
    711695    /// @}
    712696
    713697    ///\name Uniform distributions
     
    724708    /// \brief Returns a random real number from the range [0, b)
    725709    ///
    726710    /// It returns a random real number from the range [0, b).
    727     template <typename Number>
    728     Number operator()(Number b) {
    729       return real<Number>() * b;
     711    double operator()(double b) {
     712      return real<double>() * b;
    730713    }
    731714
    732715    /// \brief Returns a random real number from the range [a, b)
    733716    ///
    734717    /// It returns a random real number from the range [a, b).
    735     template <typename Number>
    736     Number operator()(Number a, Number b) {
    737       return real<Number>() * (b - a) + a;
     718    double operator()(double a, double b) {
     719      return real<double>() * (b - a) + a;
    738720    }
    739721
    740722    /// \brief Returns a random integer from a range