MTMCSim  0.5
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
MTMCSim::discrete_distribution Class Reference

Discrete Distribution, generates random number according to given pmf from uniform RVs. More...

#include <discrete_distribution.h>

Public Member Functions

 discrete_distribution ()
 
 discrete_distribution (unsigned int n_, const vector< double > &prob_)
 Constructor. More...
 
 discrete_distribution (unsigned int n_, const vector< double > &prob_, const vector< double > &val_)
 Constructor. More...
 
void setDistribution (unsigned int n_, const vector< double > &prob_)
 
void setDistributionWOGenTab (unsigned int n_, const vector< double > &prob_)
 
template<typename Engine >
double operator() (Engine &engine) const
 Random number generation operator. More...
 
double getMean () const
 
double getStdev () const
 Standard deviation. More...
 
int consumeUniRV () const
 Number of Uniform RV need to generate one RV. More...
 
void loadTab (string &tabStr)
 
void tabToStr (string &tabStr)
 

Detailed Description

Discrete Distribution, generates random number according to given pmf from uniform RVs.

Follows distribution style of Boost::random library. copy safe.

Constructor & Destructor Documentation

MTMCSim::discrete_distribution::discrete_distribution ( )
inline
MTMCSim::discrete_distribution::discrete_distribution ( unsigned int  n_,
const vector< double > &  prob_ 
)

Constructor.

Alphabet {0,1,..., n-1}

MTMCSim::discrete_distribution::discrete_distribution ( unsigned int  n_,
const vector< double > &  prob_,
const vector< double > &  val_ 
)

Constructor.

Parameters
n_alphabet size
prob_pmf
val_discrete alphabet values, the size should equal to n_

Member Function Documentation

int MTMCSim::discrete_distribution::consumeUniRV ( ) const
inline

Number of Uniform RV need to generate one RV.

double MTMCSim::discrete_distribution::getMean ( ) const
inline
double MTMCSim::discrete_distribution::getStdev ( ) const
inline

Standard deviation.

void MTMCSim::discrete_distribution::loadTab ( string &  tabStr)
template<typename Engine >
double MTMCSim::discrete_distribution::operator() ( Engine &  engine) const

Random number generation operator.

Parameters
enginea uniform pseudorandom number generator that satisfies boost::random concept
void MTMCSim::discrete_distribution::setDistribution ( unsigned int  n_,
const vector< double > &  prob_ 
)
void MTMCSim::discrete_distribution::setDistributionWOGenTab ( unsigned int  n_,
const vector< double > &  prob_ 
)
void MTMCSim::discrete_distribution::tabToStr ( string &  tabStr)

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