![]() |
Home | Libraries | People | FAQ | More |
boost::random::bernoulli_distribution
// In header: <boost/random/bernoulli_distribution.hpp> template<typename RealType = double> class bernoulli_distribution { public: // types typedef int ; typedef bool ; // member classes/structs/unions class param_type { public: // types typedef bernoulli_distribution ; // construct/copy/destruct (RealType = ); // public member functions RealType () ; // friend functions template<typename CharT, typename Traits> CharT, Traits > & (CharT, Traits > &, const param_type &); template<typename CharT, typename Traits> CharT, Traits > & (CharT, Traits > &, const param_type &); bool (const param_type &, const param_type &); bool (const param_type &, const param_type &); }; // construct/copy/destruct (const RealType & = ); (const param_type &); // public member functions RealType () ; bool () ; bool () ; param_type () ; void (const param_type &); void (); template<typename Engine> bool (Engine &) ; template<typename Engine> bool (Engine &, const param_type &) ; // friend functions template<typename CharT, typename Traits> CharT, Traits > & (CharT, Traits > &, const bernoulli_distribution &); template<typename CharT, typename Traits> CharT, Traits > & (CharT, Traits > &, const bernoulli_distribution &); bool (const bernoulli_distribution &, const bernoulli_distribution &); bool (const bernoulli_distribution &, const bernoulli_distribution &); };
Instantiations of class template bernoulli_distribution model a random distribution . Such a random distribution produces bool values distributed with probabilities P(true) = p and P(false) = 1-p. p is the parameter of the distribution.
bernoulli_distribution
public
construct/copy/destruct(const RealType & p = );
Constructs a bernoulli_distribution
object. p is the parameter of the distribution.
Requires: 0 <= p <= 1
(const param_type & param);
Constructs bernoulli_distribution
from its parameters
bernoulli_distribution
public member functionsRealType () ;
Returns: The "p" parameter of the distribution.
bool () ;
Returns the smallest value that the distribution can produce.
bool () ;
Returns the largest value that the distribution can produce.
param_type () ;
Returns the parameters of the distribution.
void (const param_type & param);
Sets the parameters of the distribution.
void ();
Effects: Subsequent uses of the distribution do not depend on values produced by any engine prior to invoking reset.
template<typename Engine> bool (Engine & eng) ;
Returns: a random variate distributed according to the bernoulli_distribution
.
template<typename Engine> bool (Engine & eng, const param_type & param) ;
Returns: a random variate distributed according to the bernoulli_distribution
with parameters specified by param.
bernoulli_distribution
friend functionstemplate<typename CharT, typename Traits> CharT, Traits > & (CharT, Traits > & os, const bernoulli_distribution & bd);
Writes the parameters of the distribution to a std::ostream
.
template<typename CharT, typename Traits> CharT, Traits > & (CharT, Traits > & is, const bernoulli_distribution & bd);
Reads the parameters of the distribution from a std::istream
.
bool (const bernoulli_distribution & lhs, const bernoulli_distribution & rhs);
Returns true iff the two distributions will produce identical sequences of values given equal generators.
bool (const bernoulli_distribution & lhs, const bernoulli_distribution & rhs);
Returns true iff the two distributions will produce different sequences of values given equal generators.