Honeycomb
0.1
Component-Model Framework
|
Generate random integer variate between min and max inclusive with uniform (flat) distribution. More...
#include <Discrete.h>
Public Member Functions | |
Discrete_ (RandomGen &gen) | |
Discrete_ (RandomGen &gen, Int min, Int max) | |
virtual Real | next () const |
Get next randomly distributed variate. Requires a random generator (see ctor or setGen()) More... | |
virtual Real | pdf (Real x) const |
virtual Real | cdf (Real x) const |
virtual Real | cdfInv (Real P) const |
virtual Real | mean () const |
Calc mean. More... | |
virtual Real | variance () const |
Calc variance. More... | |
Int | nextInt () const |
Same as next() but returns an integer rather than a real. More... | |
Public Member Functions inherited from honey::RandomDist< Numeral< Int >::Real > | |
RandomDist (optional< RandomGen & > gen=optnull) | |
Construct with a random generator to use for next() More... | |
virtual | ~RandomDist () |
virtual Numeral< Int >::Real | pdf (Numeral< Int >::Real x) const |
Probability Density Function. More... | |
virtual Numeral< Int >::Real | cdf (Numeral< Int >::Real x) const |
Cumulative Distribution Function. More... | |
virtual Numeral< Int >::Real | cdfComp (Numeral< Int >::Real x) const |
Complement of the CDF. More... | |
virtual Numeral< Int >::Real | cdfInv (Numeral< Int >::Real P) const |
Inverse of the CDF. More... | |
Numeral< Int >::Real | stdDev () const |
Calc standard deviation. More... | |
void | setGen (RandomGen &gen) |
Set random generator to use for next() More... | |
RandomGen & | getGen () const |
Get random generator. More... | |
Static Public Member Functions | |
static Int | nextStd (RandomGen &gen) |
Static function for standard distribution. Generate a random variate within full integer range (up to 64 bits) with uniform (flat) distribution. More... | |
Public Attributes | |
Int | min |
Int | max |
Additional Inherited Members | |
Protected Types inherited from honey::RandomDist< Numeral< Int >::Real > | |
typedef Numeral< Numeral< Int >::Real >::Real_ | Real_ |
typedef Real_::DoubleType | Double_ |
typedef Double_::Numeral< Int >::Real | Double |
typedef Alge_< Numeral< Int >::Real > | Alge |
typedef Alge_< Double > | Alge_d |
typedef Uniform_< Double > | Uniform |
Protected Member Functions inherited from honey::RandomDist< Numeral< Int >::Real > | |
Numeral< Int >::Real | cdfInvFind (Numeral< Int >::Real P, Numeral< Int >::Real min, Numeral< Int >::Real max, bool discrete=false) const |
Generic binary search algorithm to find Cdf. More... | |
Generate random integer variate between min and max inclusive with uniform (flat) distribution.
This is a uniform distribution, so every value in range [min, max] has equal chance.
Construct without arguments to generate variates within entire integer range (up to 64 bits), variate may be negative.
min | Minimum value. Range [-IntMax, IntMax] |
max | Maximum value. Range [-IntMax, IntMax] |
x | Random integer variate. Range (min, max) non-inclusive |
|
inline |
|
inline |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
Calc mean.
Reimplemented from honey::RandomDist< Numeral< Int >::Real >.
|
inlinevirtual |
Get next randomly distributed variate. Requires a random generator (see ctor or setGen())
Reimplemented from honey::RandomDist< Numeral< Int >::Real >.
|
inline |
Same as next() but returns an integer rather than a real.
|
inlinestatic |
Static function for standard distribution. Generate a random variate within full integer range (up to 64 bits) with uniform (flat) distribution.
|
inlinevirtual |
|
inlinevirtual |
Calc variance.
Reimplemented from honey::RandomDist< Numeral< Int >::Real >.
Int honey::Discrete_< Int >::max |
Int honey::Discrete_< Int >::min |