DiscreteUniformRandom Class Reference

Inheritance diagram for DiscreteUniformRandom:

IntegerRandom MTRand List of all members.

Detailed Description

Discrete uniform random number generator.

This class generates discrete random numbers from a uniform distribution.

Author:
Bill Smart
Date:
November 2001
Version:
1.0

Definition at line 454 of file Random.H.

Public Member Functions

 DiscreteUniformRandom (const int low, const int high, const unsigned long seed=1UL)
 DiscreteUniformRandom (const int range, const unsigned long seed=1UL)
Generate samples
int number ()
 Generate a sample from the random variable.
Moments of the random variable
double mean () const
double variance () const
double stdDev () const
Parameters of the random variable
int lowValue () const
int highValue () const
int range () const
Change parameters of the random variable
void setLowValue (const int low)
void setHighValue (const int high)
void setValues (const int low, const int high)

Private Attributes

int m_low
unsigned long m_range


Constructor & Destructor Documentation

DiscreteUniformRandom ( const int  low,
const int  high,
const unsigned long  seed = 1UL 
) [inline]

This constructor sets the low and high values for the distribution, and the random number seed.

Parameters:
low Low value for generated numbers.
high High value for generated numbers.
seed Random number seed. Do not set this to zero.
Note:
The numbers generated by this class are in the range low to high, inclusive.

Definition at line 464 of file Random.H.

DiscreteUniformRandom ( const int  range,
const unsigned long  seed = 1UL 
) [inline]

This constructor sets the high value for the distribution, and the random number seed. The low value is assumed to be 0.

Parameters:
range Range of discrete numbers to be generated.
seed Random number seed. Do not set this to zero.
Note:
The numbers generated by this class are in the range 0 to (range - 1), inclusive.

Definition at line 475 of file Random.H.


Member Function Documentation

int number (  )  [inline, virtual]

Generate a sample from the random variable.

This function generates a sample from the random variable represented by the class instance.

Returns:
A sample from the random variable.

Implements IntegerRandom.

Definition at line 480 of file Random.H.

References m_low, m_range, and MTRand::randInt().

double mean (  )  const [inline, virtual]

Returns:
The mean of the random variable.

Implements IntegerRandom.

Definition at line 485 of file Random.H.

References m_range.

double variance (  )  const [inline, virtual]

Returns:
The variance of the random variable.

Implements IntegerRandom.

Definition at line 486 of file Random.H.

References m_range.

Referenced by stdDev().

double stdDev (  )  const [inline, virtual]

Returns:
The standard deviation of the random variable.

Implements IntegerRandom.

Definition at line 487 of file Random.H.

References variance().

int lowValue (  )  const [inline]

Returns:
The low value of the range of numbers that can be generated.

Definition at line 493 of file Random.H.

References m_low.

int highValue (  )  const [inline]

Returns:
The high value of the range of numbers that can be generated.

Definition at line 495 of file Random.H.

References m_low, and m_range.

int range (  )  const [inline]

Returns:
The range of the numbers that can be generated.

Definition at line 497 of file Random.H.

References m_range.

void setLowValue ( const int  low  )  [inline]

Set the low value for the random variable.

Parameters:
low The new low value.

Definition at line 504 of file Random.H.

References m_low.

Referenced by setValues().

void setHighValue ( const int  high  )  [inline]

Set the high value for the random variable.

Parameters:
high The new high value.

Definition at line 507 of file Random.H.

References m_low, and m_range.

Referenced by setValues().

void setValues ( const int  low,
const int  high 
) [inline]

Set the both the low and high values of the random variable.

Parameters:
low Low high value.
high New high value.

Definition at line 511 of file Random.H.

References setHighValue(), and setLowValue().


Member Data Documentation

int m_low [private]

Definition at line 516 of file Random.H.

Referenced by highValue(), lowValue(), number(), setHighValue(), and setLowValue().

unsigned long m_range [private]

Definition at line 517 of file Random.H.

Referenced by highValue(), mean(), number(), range(), setHighValue(), and variance().


The documentation for this class was generated from the following file:
Generated on Thu Feb 1 15:31:55 2007 for WURDE by  doxygen 1.5.1