Honeycomb  0.1
Component-Model Framework
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
honey::Discrete_< Int > Class Template Reference

Generate random integer variate between min and max inclusive with uniform (flat) distribution. More...

#include <Discrete.h>

Inheritance diagram for honey::Discrete_< Int >:
Inheritance graph
[legend]
Collaboration diagram for honey::Discrete_< Int >:
Collaboration graph
[legend]

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...
 
RandomGengetGen () 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 >::RealAlge
 
typedef Alge_< DoubleAlge_d
 
typedef Uniform_< DoubleUniform
 
- 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...
 

Detailed Description

template<class Int>
class honey::Discrete_< Int >

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.

Parameters
minMinimum value. Range [-IntMax, IntMax]
maxMaximum value. Range [-IntMax, IntMax]
Return values
xRandom integer variate. Range (min, max) non-inclusive

Constructor & Destructor Documentation

template<class Int >
honey::Discrete_< Int >::Discrete_ ( RandomGen gen)
inline
template<class Int >
honey::Discrete_< Int >::Discrete_ ( RandomGen gen,
Int  min,
Int  max 
)
inline

Member Function Documentation

template<class Int >
virtual Real honey::Discrete_< Int >::cdf ( Real  x) const
inlinevirtual
template<class Int >
virtual Real honey::Discrete_< Int >::cdfInv ( Real  P) const
inlinevirtual
template<class Int >
virtual Real honey::Discrete_< Int >::mean ( ) const
inlinevirtual

Calc mean.

Reimplemented from honey::RandomDist< Numeral< Int >::Real >.

template<class Int >
virtual Real honey::Discrete_< Int >::next ( ) const
inlinevirtual

Get next randomly distributed variate. Requires a random generator (see ctor or setGen())

Reimplemented from honey::RandomDist< Numeral< Int >::Real >.

template<class Int >
Int honey::Discrete_< Int >::nextInt ( ) const
inline

Same as next() but returns an integer rather than a real.

template<class Int >
static Int honey::Discrete_< Int >::nextStd ( RandomGen gen)
inlinestatic

Static function for standard distribution. Generate a random variate within full integer range (up to 64 bits) with uniform (flat) distribution.

template<class Int >
virtual Real honey::Discrete_< Int >::pdf ( Real  x) const
inlinevirtual
template<class Int >
virtual Real honey::Discrete_< Int >::variance ( ) const
inlinevirtual

Calc variance.

Reimplemented from honey::RandomDist< Numeral< Int >::Real >.

Member Data Documentation

template<class Int >
Int honey::Discrete_< Int >::max
template<class Int >
Int honey::Discrete_< Int >::min

The documentation for this class was generated from the following file: