33 virtual Real
next()
const {
return static_cast<Real
>(
nextInt()); }
44 Real N()
const {
return Real(
max)-
min+1; }
Random number generator interface.
Definition: Gen.h:11
Int nextInt() const
Same as next() but returns an integer rather than a real.
Definition: Discrete.h:41
Int max
Definition: Discrete.h:48
Discrete_(RandomGen &gen)
Definition: Discrete.h:27
virtual Real cdfInv(Real P) const
Definition: Discrete.h:36
Discrete_< int32 > Discrete
Definition: Discrete.h:51
virtual uint64 next()=0
Generate random number between 0 and 2^64-1 inclusive.
static Real floor(Real x)
Round down to the nearest whole number towards -inf.
Definition: Alge.h:35
RandomGen & getGen() const
Get random generator.
Definition: Dist.h:86
static Int abs(Int x)
Get absolute value of signed integer.
Definition: Alge.h:21
virtual Real mean() const
Calc mean.
Definition: Discrete.h:37
Int min
Definition: Discrete.h:47
#define assert(...)
Forwards to assert_#args. See assert_1(), assert_2().
Definition: Debug.h:24
static Int nextStd(RandomGen &gen)
Static function for standard distribution. Generate a random variate within full integer range (up to...
Definition: Discrete.h:31
Numeric type information, use numeral() to get instance safely from a static context.
Definition: Numeral.h:17
Discrete_< int64 > Discrete_d
Definition: Discrete.h:52
static Num sqr(Num x)
Square.
Definition: Alge.h:60
virtual Real next() const
Get next randomly distributed variate. Requires a random generator (see ctor or setGen()) ...
Definition: Discrete.h:33
Generate random integer variate between min and max inclusive with uniform (flat) distribution...
Definition: Discrete.h:20
virtual Real pdf(Real x) const
Definition: Discrete.h:34
static bool isInRange(Num val, Num2 min, Num3 max)
Check if value is within min/max inclusive range.
Definition: Alge.h:112
virtual Real cdf(Real x) const
Definition: Discrete.h:35
Discrete_(RandomGen &gen, Int min, Int max)
Definition: Discrete.h:28
Global Honeycomb namespace.
virtual Real variance() const
Calc variance.
Definition: Discrete.h:38
Base class for all random distributions.
Definition: Dist.h:15