Relacs Numerics Library  0.9.8
Public Member Functions | List of all members
RandomStd Class Reference

#include <random.h>

Inheritance diagram for RandomStd:
Inheritance graph
[legend]
Collaboration diagram for RandomStd:
Collaboration graph
[legend]

Public Member Functions

 RandomStd (void)
 
 RandomStd (unsigned long seed)
 
virtual ~RandomStd (void)
 
virtual unsigned long setSeed (unsigned long seed)
 
virtual unsigned long integer (void)
 
virtual unsigned long min (void) const
 
virtual unsigned long max (void) const
 
unsigned long operator() (unsigned long n)
 
double operator() (void)
 
virtual double uniform (void)
 
virtual double gaussian (void)
 
virtual double exponential (void)
 
virtual double gamma (int a)
 
virtual string name (void)
 
- Public Member Functions inherited from RandomBase
 RandomBase (void)
 
 RandomBase (unsigned long seed)
 
virtual ~RandomBase (void)
 
unsigned long operator() (unsigned long n)
 
double operator() (void)
 

Detailed Description

An implementation of RandomBase with the random number generator from the standard C library.

Author
Jan Benda
Version
1.0

Constructor & Destructor Documentation

RandomStd ( void  )

References RandomStd::setSeed().

RandomStd ( unsigned long  seed)

References RandomStd::setSeed().

~RandomStd ( void  )
virtual

Member Function Documentation

unsigned long setSeed ( unsigned long  seed)
virtual

Set the seed of the random number generator to seed. If seed is 0, then the system time is used to generate a seed to imitate real randomness. Returns the seed.

Implements RandomBase.

Referenced by RandomStd::RandomStd().

unsigned long integer ( void  )
virtual

Returns a uniformly distributed random integer between min() and max().

Implements RandomBase.

unsigned long min ( void  ) const
virtual

The minimum value integer() returns.

Implements RandomBase.

unsigned long max ( void  ) const
virtual

The maximum value integer() returns.

Implements RandomBase.

unsigned long operator() ( unsigned long  n)
inline

Returns an uniformly distributed integer random number between zero and n. The range includes 0 but excludes n. This operator conforms to the STL RandomNumberGenerator specification. This function is NOT virtual in order to speed up computation.

References relacs::ceil().

double operator() ( void  )
inline

Returns a uniformly distributed random number between zero and one. The range includes 0.0 but excludes 1.0. This function is NOT virtual in order to speed up computation.

Referenced by RandomStd::exponential(), RandomStd::gamma(), and RandomStd::gaussian().

double uniform ( void  )
virtual

Returns a uniformly distributed random number between zero and one. The range includes 0.0 but excludes 1.0.

Implements RandomBase.

double gaussian ( void  )
virtual

Returns a unit gaussian distributed random number.

Implements RandomBase.

References relacs::log(), RandomStd::operator()(), and relacs::sqrt().

double exponential ( void  )
virtual

Returns an exponential distributed random number with mean one.

Reimplemented from RandomBase.

References relacs::log(), and RandomStd::operator()().

double gamma ( int  a)
virtual

Returns a gamma distributed random number p(x) dx = x^(a-1) exp(-x)/Gamma(a) dx.

Reimplemented from RandomBase.

References relacs::exp(), relacs::log(), RandomStd::operator()(), and relacs::sqrt().

string name ( void  )
virtual

The name of the random number generator ("rand").

Implements RandomBase.


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