pf
|
A class that performs sampling from a univariate Bernoulli distribution. More...
#include <rv_samp.h>
Public Member Functions | |
BernSampler () | |
Default-constructor sets up for Bernoulli random variate generation with p = .5. | |
BernSampler (float_t p) | |
Constructs Bernoulli sampler with user-specified p. More... | |
void | setP (float_t p) |
sets the parameter p. More... | |
int_t | sample () |
Draws a random number. More... | |
![]() | |
rvsamp_base () | |
The default constructor. This is the only option available. Sets the seed with the clock. | |
Private Attributes | |
std::bernoulli_distribution | m_B_gen |
makes normal random variates | |
float_t | m_p |
the mean | |
Additional Inherited Members | |
![]() | |
std::mt19937 | m_rng |
prng | |
A class that performs sampling from a univariate Bernoulli distribution.
pf::rvsamp::BernSampler< float_t, int_t >::BernSampler | ( | float_t | p | ) |
Constructs Bernoulli sampler with user-specified p.
p | a float_t for the probability that the rv equals 1. |
int_t pf::rvsamp::BernSampler< float_t, int_t >::sample |
Draws a random number.
void pf::rvsamp::BernSampler< float_t, int_t >::setP | ( | float_t | p | ) |
sets the parameter p.
p | the p(X=1) = 1-p(X=0). |