I have either overlooked something basic or found a bug in the random library: boost::mt19937 engine_; double result_ = boost::uniform_real<double>(0., 1.) (engine_); std::cout << result_ << std::endl; assert ( (0. <= result_) && (result_ < 1.) ); results in 4.29093e+09 test_boost: test/test_boost.cpp:17: void test_random (): Assertion `(0. <= result_) && (result_ < 1.)' failed. Abort Although the documentation says "The current implementation is buggy, because it may not fill all of the mantissa with random bits." IMHO this is worse than that: I expected the result to satisfy min <= result < max. I'm using boost 1.31.0 and g++ 2.96 as well as g++ 3.3.2 (identical results) on Red Hat Linux. I hope that either someone can explain me my mistake or fix the bug. Matthias Rupp
participants (1)
-
rupp@stud.uni-frankfurt.de