
I seriously hope I'm doing something wrong here, but the last 20 bits in a double returned from uniform_real appear to always be zero. Is this by design? I really hope not! Here's the test code: template <class T> void test_random(T) { boost::mt19937 rnd; boost::uniform_real<T> ur_a(0.5, 1); boost::variate_generator<std::tr1::mt19937, std::tr1::uniform_real<T> > gen(rnd, ur_a); for(int j = 0; j < INT_MAX-2; ++j) { T v = gen(); // get the digits of T: unsigned long long i = (unsigned long long)std::floor(std::ldexp(v, std::numeric_limits<T>::digits)); i &= 0xfffff; // last 20 bits std::cout << std::hex << i << std::endl; } } Try calling with a double as an argument and it'll output nothing but zero's. John.