Bugfix in Random (#173)
authorAlpar Juttner <alpar@cs.elte.hu>
Tue, 11 Nov 2008 10:12:37 +0000
changeset 391c4aa9f097ef1
parent 322 6dbd5184c6a9
child 392 80ec623f529f
child 393 7d85a624093e
child 412 62f9787c516c
Bugfix in Random (#173)

- operator()s always return a double now
- the faulty real<Num>(Num) and real<Num>(Num,Num) have been removed
lemon/random.h
     1.1 --- a/lemon/random.h	Sun Oct 12 19:35:48 2008 +0100
     1.2 +++ b/lemon/random.h	Tue Nov 11 10:12:37 2008 +0000
     1.3 @@ -692,22 +692,6 @@
     1.4        return real<double>();
     1.5      }
     1.6  
     1.7 -    /// \brief Returns a random real number the range [0, b)
     1.8 -    ///
     1.9 -    /// It returns a random real number from the range [0, b).
    1.10 -    template <typename Number>
    1.11 -    Number real(Number b) {
    1.12 -      return real<Number>() * b;
    1.13 -    }
    1.14 -
    1.15 -    /// \brief Returns a random real number from the range [a, b)
    1.16 -    ///
    1.17 -    /// It returns a random real number from the range [a, b).
    1.18 -    template <typename Number>
    1.19 -    Number real(Number a, Number b) {
    1.20 -      return real<Number>() * (b - a) + a;
    1.21 -    }
    1.22 -
    1.23      /// @}
    1.24  
    1.25      ///\name Uniform distributions
    1.26 @@ -724,17 +708,15 @@
    1.27      /// \brief Returns a random real number from the range [0, b)
    1.28      ///
    1.29      /// It returns a random real number from the range [0, b).
    1.30 -    template <typename Number>
    1.31 -    Number operator()(Number b) {
    1.32 -      return real<Number>() * b;
    1.33 +    double operator()(double b) {
    1.34 +      return real<double>() * b;
    1.35      }
    1.36  
    1.37      /// \brief Returns a random real number from the range [a, b)
    1.38      ///
    1.39      /// It returns a random real number from the range [a, b).
    1.40 -    template <typename Number>
    1.41 -    Number operator()(Number a, Number b) {
    1.42 -      return real<Number>() * (b - a) + a;
    1.43 +    double operator()(double a, double b) {
    1.44 +      return real<double>() * (b - a) + a;
    1.45      }
    1.46  
    1.47      /// \brief Returns a random integer from a range