casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Private Member Functions | Private Attributes
casa::DiscreteUniform Class Reference

Discrete uniform distribution. More...

#include <Random.h>

Inheritance diagram for casa::DiscreteUniform:
casa::Random

List of all members.

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< Doubleparameters () 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

Detailed Description

Discrete uniform distribution.

Synopsis

The <tt>DiscreteUniform</tt> class implements a quantized uniform random
variable over the closed interval ranging from <tt>[low..high]</tt>.  The
<tt>low</tt> parameter is the lowest possible return value and the
<tt>high</tt> parameter is the highest.  The <tt>operator()</tt>
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.

<h3>Example</h3> @anchor Random_example

Thrown Exceptions

To Do

Definition at line 661 of file Random.h.


Constructor & Destructor Documentation

casa::DiscreteUniform::DiscreteUniform ( RNG gen,
Int  low = -1,
Int  high = 1 
)

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.

The destructor is trivial.


Member Function Documentation

static Double casa::DiscreteUniform::calcDelta ( Int  low,
Int  high 
) [static, private]

   

virtual Bool casa::DiscreteUniform::checkParameters ( const Vector< Double > &  parms) const [virtual]

Implements casa::Random.

Int casa::DiscreteUniform::high ( ) const [inline]

Definition at line 712 of file Random.h.

References itsHigh.

Int casa::DiscreteUniform::low ( ) const [inline]

Functions that allow you to query and change the parameters of the discrete uniform distribution.

Definition at line 708 of file Random.h.

References itsLow.

virtual Double casa::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 casa::Random.

virtual Vector<Double> casa::DiscreteUniform::parameters ( ) const [virtual]

Implements casa::Random.

void casa::DiscreteUniform::range ( Int  low,
Int  high 
)
virtual void casa::DiscreteUniform::setParameters ( const Vector< Double > &  parms) [virtual]

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 casa::Random.


Member Data Documentation

Definition at line 705 of file Random.h.

Definition at line 704 of file Random.h.

Referenced by high().

Definition at line 703 of file Random.h.

Referenced by low().


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