Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::random::geometric_distribution< IntType, RealType > Class Template Reference

An instantiation of the class template geometric_distribution models a . More...

#include <geometric_distribution.hpp>

Classes

class  param_type
 

Public Types

typedef RealType input_type
 
typedef IntType result_type
 

Public Member Functions

 geometric_distribution (const RealType &p_arg=RealType(0.5))
 Contructs a new geometric_distribution with the paramter p. More...
 
 geometric_distribution (const param_type &parm)
 Constructs a new geometric_distribution from its parameters. More...
 
RealType p () const
 Returns: the distribution parameter p. More...
 
IntType min BOOST_PREVENT_MACRO_SUBSTITUTION () const
 Returns the smallest value that the distribution can produce. More...
 
IntType max BOOST_PREVENT_MACRO_SUBSTITUTION () const
 Returns the largest value that the distribution can produce. More...
 
param_type param () const
 Returns the parameters of the distribution. More...
 
void param (const param_type &parm)
 Sets the parameters of the distribution. More...
 
void reset ()
 Effects: Subsequent uses of the distribution do not depend on values produced by any engine prior to invoking reset. More...
 
template<class Engine >
result_type operator() (Engine &eng) const
 Returns a random variate distributed according to the geometric_distribution. More...
 
template<class Engine >
result_type operator() (Engine &eng, const param_type &parm) const
 Returns a random variate distributed according to the geometric distribution with parameters specified by param. More...
 
 BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR (os, geometric_distribution, gd)
 Writes the distribution to a std::ostream. More...
 
 BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR (is, geometric_distribution, gd)
 Reads the distribution from a std::istream. More...
 
 BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR (geometric_distribution, lhs, rhs)
 Returns true if the two distributions will produce identical sequences of values given equal generators. More...
 

Detailed Description

template<class IntType = int, class RealType = double>
class boost::random::geometric_distribution< IntType, RealType >

An instantiation of the class template geometric_distribution models a .

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, $p(i) = p(1-p)^{i}$.

This distribution has been updated to match the C++ standard. Its behavior has changed from the original boost::geometric_distribution. A backwards compatible wrapper is provided in namespace boost.

Member Typedef Documentation

template<class IntType = int, class RealType = double>
typedef RealType boost::random::geometric_distribution< IntType, RealType >::input_type
template<class IntType = int, class RealType = double>
typedef IntType boost::random::geometric_distribution< IntType, RealType >::result_type

Constructor & Destructor Documentation

template<class IntType = int, class RealType = double>
boost::random::geometric_distribution< IntType, RealType >::geometric_distribution ( const RealType &  p_arg = RealType(0.5))
inlineexplicit

Contructs a new geometric_distribution with the paramter p.

Requires: 0 < p < 1

References BOOST_ASSERT, and boost::unit_test::framework::init().

Referenced by boost::random::geometric_distribution< IntType, RealType >::operator()().

template<class IntType = int, class RealType = double>
boost::random::geometric_distribution< IntType, RealType >::geometric_distribution ( const param_type parm)
inlineexplicit

Constructs a new geometric_distribution from its parameters.

References boost::unit_test::framework::init().

Member Function Documentation

template<class IntType = int, class RealType = double>
IntType min boost::random::geometric_distribution< IntType, RealType >::BOOST_PREVENT_MACRO_SUBSTITUTION ( ) const
inline

Returns the smallest value that the distribution can produce.

template<class IntType = int, class RealType = double>
IntType max boost::random::geometric_distribution< IntType, RealType >::BOOST_PREVENT_MACRO_SUBSTITUTION ( ) const
inline

Returns the largest value that the distribution can produce.

References boost::accumulators::extract::max.

template<class IntType = int, class RealType = double>
boost::random::geometric_distribution< IntType, RealType >::BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR ( geometric_distribution< IntType, RealType >  ,
lhs  ,
rhs   
)
inline

Returns true if the two distributions will produce identical sequences of values given equal generators.

template<class IntType = int, class RealType = double>
boost::random::geometric_distribution< IntType, RealType >::BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR ( is  ,
geometric_distribution< IntType, RealType >  ,
gd   
)
inline

Reads the distribution from a std::istream.

template<class IntType = int, class RealType = double>
boost::random::geometric_distribution< IntType, RealType >::BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR ( os  ,
geometric_distribution< IntType, RealType >  ,
gd   
)
inline

Writes the distribution to a std::ostream.

template<class IntType = int, class RealType = double>
template<class Engine >
result_type boost::random::geometric_distribution< IntType, RealType >::operator() ( Engine &  eng) const
inline

Returns a random variate distributed according to the geometric_distribution.

References boost::chrono::floor(), boost::math::ef::log(), and boost::flyweights::x.

template<class IntType = int, class RealType = double>
template<class Engine >
result_type boost::random::geometric_distribution< IntType, RealType >::operator() ( Engine &  eng,
const param_type parm 
) const
inline

Returns a random variate distributed according to the geometric distribution with parameters specified by param.

References boost::random::geometric_distribution< IntType, RealType >::geometric_distribution().

template<class IntType = int, class RealType = double>
RealType boost::random::geometric_distribution< IntType, RealType >::p ( ) const
inline

Returns: the distribution parameter p.

template<class IntType = int, class RealType = double>
param_type boost::random::geometric_distribution< IntType, RealType >::param ( ) const
inline

Returns the parameters of the distribution.

References boost::random::geometric_distribution< IntType, RealType >::param_type::param_type().

template<class IntType = int, class RealType = double>
void boost::random::geometric_distribution< IntType, RealType >::param ( const param_type parm)
inline
template<class IntType = int, class RealType = double>
void boost::random::geometric_distribution< IntType, RealType >::reset ( void  )
inline

Effects: Subsequent uses of the distribution do not depend on values produced by any engine prior to invoking reset.


The documentation for this class was generated from the following file: