Correctly bias the range::random function with min

This commit is contained in:
Danny Robson 2011-10-03 19:20:46 +11:00
parent 2e091079d2
commit 6e2ba427f9

View File

@ -78,7 +78,7 @@ template <typename T>
T
range<T>::random (void) const {
double pos = ::rand () / (double)(RAND_MAX);
return (max - min) * pos;
return (max - min) * pos + min;
}