Discrete uniform distribution. More...
#include <Random.h>
Public Member Functions | |
DiscreteUniform (RNG *gen, Int low=-1, Int high=1) | |
Construct a random number generator for a discrete uniform distribution. | |
virtual | ~DiscreteUniform () |
The destructor is trivial. | |
virtual Double | operator() () |
Returns a value from the discrete uniform distribution. | |
Int | asInt () |
Int | low () const |
Functions that allow you to query and change the parameters of the discrete uniform distribution. | |
void | low (Int x) |
Int | high () const |
void | high (Int x) |
void | range (Int low, Int high) |
virtual void | setParameters (const Vector< Double > &parms) |
These function allow you to manipulate the parameters (low & high) described above through the base class. | |
virtual Vector< Double > | parameters () const |
virtual Bool | checkParameters (const Vector< Double > &parms) const |
Static Private Member Functions | |
static Double | calcDelta (Int low, Int high) |
Private Attributes | |
Int | itsLow |
Int | itsHigh |
Double | itsDelta |
Discrete uniform distribution.
The DiscreteUniform
class implements a quantized uniform random variable over the closed interval ranging from [low..high]
. The low
parameter is the lowest possible return value and the high
parameter is the highest. The operator()
functions returns a value from this distribution. It is possible to get this same value as an integer using the asInt function.
It is assumed that low limit is less than the high limit and an AipsError exception thrown if this is not true. The remaining members allow you to read and set the parameters.
Definition at line 661 of file Random.h.
Construct a random number generator for a discrete uniform distribution.
The first argument is a class that produces random bits. This pointer is NOT taken over by this class and the user is responsible for deleting it. The second and third arguments define the range of possible return values for this distribution as described in the synopsis.
virtual casacore::DiscreteUniform::~DiscreteUniform | ( | ) | [virtual] |
The destructor is trivial.
Int casacore::DiscreteUniform::asInt | ( | ) |
virtual Bool casacore::DiscreteUniform::checkParameters | ( | const Vector< Double > & | parms | ) | const [virtual] |
Implements casacore::Random.
void casacore::DiscreteUniform::high | ( | Int | x | ) |
Int casacore::DiscreteUniform::high | ( | ) | const [inline] |
void casacore::DiscreteUniform::low | ( | Int | x | ) |
Int casacore::DiscreteUniform::low | ( | ) | const [inline] |
virtual Double casacore::DiscreteUniform::operator() | ( | ) | [virtual] |
Returns a value from the discrete uniform distribution.
The returned value is a integer and using the asInt function bypasses the conversion to a floating point number.
Implements casacore::Random.
Implements casacore::Random.
These function allow you to manipulate the parameters (low & high) described above through the base class.
The Vectors must always be of length two.
Implements casacore::Random.
Double casacore::DiscreteUniform::itsDelta [private] |
Int casacore::DiscreteUniform::itsHigh [private] |
Int casacore::DiscreteUniform::itsLow [private] |