# 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 return real(); } /// \brief Returns a random real number the range [0, b) /// /// It returns a random real number from the range [0, b). template Number real(Number b) { return real() * b; } /// \brief Returns a random real number from the range [a, b) /// /// It returns a random real number from the range [a, b). template Number real(Number a, Number b) { return real() * (b - a) + a; } /// @} ///\name Uniform distributions /// \brief Returns a random real number from the range [0, b) /// /// It returns a random real number from the range [0, b). template Number operator()(Number b) { return real() * b; double operator()(double b) { return real() * b; } /// \brief Returns a random real number from the range [a, b) /// /// It returns a random real number from the range [a, b). template Number operator()(Number a, Number b) { return real() * (b - a) + a; double operator()(double a, double b) { return real() * (b - a) + a; } /// \brief Returns a random integer from a range