|
spot
2.16
|
Compute pseudo-random integer value between 0 and n included, following a binomial distribution with probability p. More...
#include <spot/misc/random.hh>
Public Member Functions | |
| barand (int n, double p) | |
| Build a binomial random generator. More... | |
| int | rand () const |
| Return a random value. More... | |
Protected Attributes | |
| const int | n_ |
| Upper bound. More... | |
| const double | m_ |
| Mean. More... | |
| const double | s_ |
| Standard deviation. More... | |
Compute pseudo-random integer value between 0 and n included, following a binomial distribution with probability p.
gen must be a random function computing a pseudo-random double value following a standard normal distribution. Use nrand() or bmrand().
Usually approximating a binomial distribution using a normal distribution and is accurate only if n*p and n*(1-p) are greater than 5.
|
inline |
Build a binomial random generator.
|
inline |
Return a random value.
References spot::barand< gen >::m_, spot::barand< gen >::n_, and spot::barand< gen >::s_.
|
protected |
Mean.
Referenced by spot::barand< gen >::rand().
|
protected |
Upper bound.
Referenced by spot::barand< gen >::rand().
|
protected |
Standard deviation.
Referenced by spot::barand< gen >::rand().
1.9.1