...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::random::uniform_01
// In header: <boost/random/uniform_01.hpp> template<typename RealType = double> class uniform_01 { public: // types typedef RealType input_type; typedef RealType result_type; // public member functions result_type min() const; result_type max() const; void reset(); template<typename Engine> result_type operator()(Engine &); };
The distribution function uniform_01 models a random distribution . On each invocation, it returns a random floating-point value uniformly distributed in the range [0..1).
The template parameter RealType shall denote a float-like value type with support for binary operators +, -, and /.
Note: The current implementation is buggy, because it may not fill all of the mantissa with random bits. I'm unsure how to fill a (to-be-invented) boost::bigfloat
class with random bits efficiently. It's probably time for a traits class.