NormalRandom Class Reference

Inheritance diagram for NormalRandom:

RealRandom MTRand List of all members.

Detailed Description

Normal random number generator.

This class generates random numbers from a Gaussian distribution.

Author:
Bill Smart
Date:
November 2001
Version:
1.0
Note:
This class uses functions from the standard math library. Be sure to include it on the compile line.

Definition at line 338 of file Random.H.

Public Member Functions

 NormalRandom (const double mean=0.0, const double variance=1.0, const unsigned long seed=1UL)
Generate samples
double number ()
 Generate a sample from the random variable.
Moments of the random variable
double mean () const
double variance () const
double stdDev () const
Change parameters of the random variable
void setMean (const double mean)
void setVariance (const double variance)
void setStdDev (const double std_dev)
void setParameters (const double mean, const double variance)

Private Attributes

double m_mean
double m_std_dev


Constructor & Destructor Documentation

NormalRandom ( const double  mean = 0.0,
const double  variance = 1.0,
const unsigned long  seed = 1UL 
) [inline]

This constructor sets the mean and the variance of the random variable, and also the random number seed.

Parameters:
mean The mean of the random variable.
variance The variance of the random variable.
seed Random number seed. Do not set this to zero.

Definition at line 346 of file Random.H.


Member Function Documentation

double 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 RealRandom.

Definition at line 659 of file Random.H.

References m_mean, m_std_dev, and MTRand::rand().

double mean (  )  const [inline, virtual]

Returns:
The mean of the random variable.

Implements RealRandom.

Definition at line 357 of file Random.H.

References m_mean.

double variance (  )  const [inline, virtual]

Returns:
The variance of the random variable.

Implements RealRandom.

Definition at line 358 of file Random.H.

References m_std_dev.

double stdDev (  )  const [inline, virtual]

Returns:
The standard deviation of the random variable.

Implements RealRandom.

Definition at line 359 of file Random.H.

References m_std_dev.

void setMean ( const double  mean  )  [inline]

Set the mean of the random variable.

Parameters:
mean The new mean of the random variable.

Definition at line 366 of file Random.H.

References m_mean.

Referenced by setParameters().

void setVariance ( const double  variance  )  [inline]

Set the variance of the random variable.

Parameters:
variance The new variance of the random variable.

Definition at line 369 of file Random.H.

References m_std_dev.

Referenced by setParameters().

void setStdDev ( const double  std_dev  )  [inline]

Set the standard deviation of the random variable.

Parameters:
std_dev The new standard deviation of the random variable.

Definition at line 372 of file Random.H.

References m_std_dev.

void setParameters ( const double  mean,
const double  variance 
) [inline]

Set the mean and variance of the random variable.

Parameters:
mean The new mean of the random variable.
variance The new variance of the random variable.

Definition at line 376 of file Random.H.

References setMean(), and setVariance().


Member Data Documentation

double m_mean [private]

Definition at line 381 of file Random.H.

Referenced by mean(), number(), and setMean().

double m_std_dev [private]

Definition at line 382 of file Random.H.

Referenced by number(), setStdDev(), setVariance(), stdDev(), 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