Models a binomial distribution with parameters p and n. More...
#include <shark/Rng/Binomial.h>
Public Member Functions | |
Binomial (RngType &rng, unsigned int n=1, double prob=0.5) | |
C'tor, initializes parameters n and p, initializes for a custom RNG. More... | |
long | operator() (unsigned int n, double prob) |
Samples a random number from the distribution with parameter n and p. More... | |
double | prob () const |
Accesses the parameter p of the distirbution. More... | |
void | prob (double newProb) |
Adjusts the parameter p of the distribution. More... | |
unsigned int | n () const |
Accesses the parameter n of the distribution. More... | |
void | n (unsigned int newN) |
Adjusts the parameter n of the distribution. More... | |
double | p (long k) const |
Implements the pmf of the distribution. More... | |
Models a binomial distribution with parameters p and n.
Definition at line 49 of file Binomial.h.
|
inline |
C'tor, initializes parameters n and p, initializes for a custom RNG.
[in,out] | rng | The random number generator. |
[in] | n | Parameter n.descibing the number of coin tosses |
[in] | prob | Parameter p. |
Definition at line 60 of file Binomial.h.
|
inline |
Accesses the parameter n of the distribution.
Definition at line 94 of file Binomial.h.
Referenced by shark::Binomial< RngType >::p(), and shark::Binomial< RngType >::prob().
|
inline |
Adjusts the parameter n of the distribution.
Definition at line 101 of file Binomial.h.
References shark::Binomial< RngType >::prob().
|
inline |
Samples a random number from the distribution with parameter n and p.
Definition at line 72 of file Binomial.h.
|
inline |
Implements the pmf of the distribution.
[in] | k | Number of successful trials. |
std::overflow_error | if the result is too large to be represented in type double. |
Definition at line 111 of file Binomial.h.
References shark::Binomial< RngType >::n(), and shark::Binomial< RngType >::prob().
|
inline |
Accesses the parameter p of the distirbution.
Definition at line 80 of file Binomial.h.
Referenced by shark::Binomial< RngType >::n(), and shark::Binomial< RngType >::p().
|
inline |
Adjusts the parameter p of the distribution.
Definition at line 87 of file Binomial.h.
References shark::Binomial< RngType >::n().