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 geometric_distribution

boost::geometric_distribution

Synopsis

// In header: <boost/random/geometric_distribution.hpp>

template<typename IntType = int, typename RealType = double> 
class geometric_distribution {
public:
  // types
  typedef RealType input_type; 
  typedef IntType  result_type;

  // construct/copy/destruct
  geometric_distribution(const RealType & = RealType(0.5));

  // public member functions
  RealType p() const;
  void reset();
  template<typename Engine> result_type operator()(Engine &);
};

Description

An instantiation of the class template geometric_distribution models a random distribution . The distribution produces positive integers which are the number of bernoulli trials with probability p required to get one that fails.

For the geometric distribution, .

geometric_distribution public construct/copy/destruct

  1. geometric_distribution(const RealType & p = RealType(0.5));

    Contructs a new geometric_distribution with the paramter p.

    Requires: 0 < p < 1

geometric_distribution public member functions

  1. RealType p() const;

    Returns: the distribution parameter p

  2. void reset();
  3. template<typename Engine> result_type operator()(Engine & eng);

PrevUpHomeNext