Random Class Reference

List of all members.


Detailed Description

Random numbers.

Author:
Lawrence Murray <lawrence@indii.org>
Version:
Rev
Date:
Date
This class makes use of the random number generation features of the GSL, in particular making use of the MT19937 generator of Matsumoto & Nishimura (1998). If not explicitly seeded, it is seeded with the current time as returned by the system's time() function the first time one of the provided functions is called.

More information on the implementation of this random number generator is available in the GSL manual.

References

The GNU Scientific Library (GSL). http://www.gnu.org/software/gsl/

Matsumoto, M. and Nishimura, T. Mersenne Twister: A 623-dimensionally equidistributed uniform pseudorandom number generator. ACM Transactions on Modeling and Computer Simulation, 1998, 8, 3-30.

Definition at line 40 of file Random.hpp.


Static Public Member Functions

static void seed (unsigned int seed)
 Seed the random number generator.
static double uniform (const double lower=0.0, const double upper=1.0)
 Generate a random number from a uniform distribution over the given interval.
static double gaussian (const double mean=0.0, const double sigma=1.0)
 Generate a random number from a Gaussian distribution with the given mean and standard deviation.
static unsigned int bernoulli (const double p=0.5)
 Generate a boolean value from a Bernoulli distribution.
static vector unitVector (const unsigned int N)
 Generate a random unit vector.
static matrix orthonormalMatrix (const unsigned int N)
 Generate a random orthonormal matrix.

Member Function Documentation

void seed ( unsigned int  seed  )  [static]

Seed the random number generator.

Parameters:
seed Seed value.
Seeds the random number generator for future use using the given seed value. If not explicitly seeded, the generator is seeded with the current time the first time it is used.

Definition at line 24 of file Random.cpp.

double uniform ( const double  lower = 0.0,
const double  upper = 1.0 
) [inline, static]

Generate a random number from a uniform distribution over the given interval.

Parameters:
lower Lower bound on the interval.
upper Upper bound on the interval.
Returns:
The random number.

Definition at line 129 of file Random.hpp.

double gaussian ( const double  mean = 0.0,
const double  sigma = 1.0 
) [inline, static]

Generate a random number from a Gaussian distribution with the given mean and standard deviation.

Parameters:
mean Mean of the distribution.
sigma Standard deviation of the distribution.
Returns:
The random number.

Definition at line 137 of file Random.hpp.

unsigned int bernoulli ( const double  p = 0.5  )  [inline, static]

Generate a boolean value from a Bernoulli distribution.

Parameters:
p Probability of true, between 0 and 1 inclusive.
Returns:
The random boolean value, 1 for true, 0 for false.

Definition at line 145 of file Random.hpp.

vector unitVector ( const unsigned int  N  )  [static]

Generate a random unit vector.

Parameters:
N Size of unit vector.
Returns:
Random unit vector in N dimensions.

Definition at line 62 of file Random.cpp.

matrix orthonormalMatrix ( const unsigned int  N  )  [static]

Generate a random orthonormal matrix.

Parameters:
N Size of matrix.
Returns:
Random N by N orthonormal matrix.

Todo:
Should check random for full rank, just in case, although it's highly unlikely that the set is linearly dependent.

Definition at line 75 of file Random.cpp.


Generated on Wed Dec 17 15:11:58 2008 for dysii Dynamical Systems Library by  doxygen 1.5.3