Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Class template uniform_01

boost::random::uniform_01

Synopsis

// 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 &);
};

Description

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.

uniform_01 public member functions

  1. result_type min() const;
  2. result_type max() const;
  3. void reset();
  4. template<typename Engine> result_type operator()(Engine & eng);

PrevUpHomeNext