
Hello, I'm using Boost 1.54. The following code hangs in infinite loop when generating a single floating point number : #include <boost/random.hpp> #include <iostream> #include <limits> int main() { boost::random::mt19937 rng; boost::random::uniform_real_distribution<float> distrib( -std::numeric_limits<float>::max(), std::numeric_limits<float>::max()); std::cout << distrib(rng) << std::endl; return 0; } I can reproduce the bug with both - Linux GCC 4.8 x86_64 and - Windows VisualStudio 2012 32bits It looks like this uniform distribution doesn't work if the range [min,max] is large. From uniform_real_distribution.hpp:61 T result = numerator / divisor * (max_value - min_value) + min_value; Here the operation (max_value - min_value) produces an overflow. Regards, Jeremy