Implements the geometric distribution. More...
#include <shark/Rng/Geometric.h>
Public Member Functions | |
Geometric (RngType &rng, double p=0.5) | |
C'tor, initializes the parameter p modelling the probability of success. Associates the distribution with a custom RNG. More... | |
long | operator() (double p) |
Reinitializes the distribution with the supplied success probability and samples a random number. More... | |
double | prob () const |
Accesses the success probability. More... | |
void | prob (double newMean) |
Adjusts the success probability. More... | |
double | p (long x) |
Calculates the probability of x. More... | |
Implements the geometric distribution.
Note that a support {1,2,3,...} is assumed here.
Definition at line 47 of file Geometric.h.
|
inline |
C'tor, initializes the parameter p modelling the probability of success. Associates the distribution with a custom RNG.
[in,out] | rng | The RNG to associate the distribution with. |
[in] | p | Parameter p, the probability of success. |
Definition at line 58 of file Geometric.h.
|
inline |
Reinitializes the distribution with the supplied success probability and samples a random number.
[in] | p | The new success probability. |
Definition at line 69 of file Geometric.h.
|
inline |
Calculates the probability of x.
Definition at line 91 of file Geometric.h.
References shark::Geometric< RngType >::prob().
|
inline |
Accesses the success probability.
Definition at line 77 of file Geometric.h.
Referenced by shark::Geometric< RngType >::p().
|
inline |
Adjusts the success probability.
Definition at line 84 of file Geometric.h.