STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
bernoulli_distribution Class Reference

Classes

struct  param_type
 

Public Types

typedef bernoulli_distribution _Myt
 
typedef bool result_type
 

Public Member Functions

 bernoulli_distribution (double _P0=0.5)
 
 bernoulli_distribution (const param_type &_Par0)
 
double p () const
 
param_type param () const
 
void param (const param_type &_Par0)
 
result_type() min () const
 
result_type() max () const
 
void reset ()
 
template<class _Engine >
result_type operator() (_Engine &_Eng) const
 
template<class _Engine >
result_type operator() (_Engine &_Eng, const param_type &_Par0) const
 
template<class _Elem , class _Traits >
basic_istream< _Elem, _Traits > & _Read (basic_istream< _Elem, _Traits > &_Istr)
 
template<class _Elem , class _Traits >
basic_ostream< _Elem, _Traits > & _Write (basic_ostream< _Elem, _Traits > &_Ostr) const
 

Private Member Functions

template<class _Engine >
result_type _Eval (_Engine &_Eng, const param_type &_Par0) const
 

Private Attributes

param_type _Par
 

Member Typedef Documentation

Constructor & Destructor Documentation

bernoulli_distribution::bernoulli_distribution ( double  _P0 = 0.5)
inlineexplicit
2513  : _Par(_P0)
2514  { // construct
2515  }
param_type _Par
Definition: random:2590
bernoulli_distribution::bernoulli_distribution ( const param_type _Par0)
inlineexplicit
2518  : _Par(_Par0)
2519  { // construct from parameter package
2520  }
param_type _Par
Definition: random:2590

Member Function Documentation

template<class _Engine >
result_type bernoulli_distribution::_Eval ( _Engine &  _Eng,
const param_type _Par0 
) const
inlineprivate
2586  { // return next value
2587  return (_NRAND(_Eng, double) < _Par0._Px);
2588  }
#define _NRAND(eng, resty)
Definition: random:345
template<class _Elem , class _Traits >
basic_istream<_Elem, _Traits>& bernoulli_distribution::_Read ( basic_istream< _Elem, _Traits > &  _Istr)
inline
2567  { // read state from _Istr
2568  double _P0;
2569  _In(_Istr, _P0);
2570  _Par._Init(_P0);
2571  return (_Istr);
2572  }
basic_istream< _Elem, _Traits > & _In(basic_istream< _Elem, _Traits > &_Is, _Ty &_Dx)
Definition: random:156
param_type _Par
Definition: random:2590
void _Init(double _P0)
Definition: random:2501
template<class _Elem , class _Traits >
basic_ostream<_Elem, _Traits>& bernoulli_distribution::_Write ( basic_ostream< _Elem, _Traits > &  _Ostr) const
inline
2578  { // write state to _Ostr
2579  _Out(_Ostr, _Par._Px);
2580  return (_Ostr);
2581  }
basic_ostream< _Elem, _Traits > & _Out(basic_ostream< _Elem, _Traits > &_Os, _Ty _Dx)
Definition: random:174
double _Px
Definition: random:2509
param_type _Par
Definition: random:2590
result_type() bernoulli_distribution::max ( ) const
inline
2543  { // get largest possible result
2544  return (true);
2545  }
result_type() bernoulli_distribution::min ( ) const
inline
2538  { // get smallest possible result
2539  return (false);
2540  }
template<class _Engine >
result_type bernoulli_distribution::operator() ( _Engine &  _Eng) const
inline
2553  { // return next value
2554  return (_Eval(_Eng, _Par));
2555  }
result_type _Eval(_Engine &_Eng, const param_type &_Par0) const
Definition: random:2585
param_type _Par
Definition: random:2590
template<class _Engine >
result_type bernoulli_distribution::operator() ( _Engine &  _Eng,
const param_type _Par0 
) const
inline
2559  { // return next value, given parameter package
2560  return (_Eval(_Eng, _Par0));
2561  }
result_type _Eval(_Engine &_Eng, const param_type &_Par0) const
Definition: random:2585
double bernoulli_distribution::p ( ) const
inline
2523  { // return probability
2524  return (_Par.p());
2525  }
param_type _Par
Definition: random:2590
double p() const
Definition: random:2496
param_type bernoulli_distribution::param ( ) const
inline
2528  { // return parameter package
2529  return (_Par);
2530  }
param_type _Par
Definition: random:2590
void bernoulli_distribution::param ( const param_type _Par0)
inline
2533  { // set parameter package
2534  _Par = _Par0;
2535  }
param_type _Par
Definition: random:2590
void bernoulli_distribution::reset ( )
inline
2548  { // clear internal state
2549  }

Member Data Documentation

param_type bernoulli_distribution::_Par
private

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