Relacs  0.9.8
Public Member Functions | Protected Attributes | List of all members
RandomGSL Class Reference

#include <random.h>

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

Public Member Functions

 RandomGSL (const gsl_rng_type *rt=gsl_rng_mt19937)
 
 RandomGSL (unsigned long seed, const gsl_rng_type *rt=gsl_rng_mt19937)
 
virtual ~RandomGSL (void)
 
virtual unsigned long setSeed (unsigned long seed)
 
virtual unsigned long integer (void)
 
unsigned long integer (unsigned long int max)
 
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)
 
double positive (void)
 
virtual double gaussian (void)
 
double gaussian (double sigma)
 
virtual double exponential (void)
 
double exponential (double mu)
 
virtual double gamma (double a)
 
double gamma (double a, double b)
 
double lognormal (double zeta, double sigma)
 
double chisq (double nu)
 
double fdist (double nu1, double nu2)
 
double tdist (double nu)
 
unsigned int poisson (double mu)
 
int binomial (double p, int n)
 
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)
 
virtual double gamma (int a)
 

Protected Attributes

gsl_rng * Rng
 

Detailed Description

An implementation of RandomBase for the random number generators from the GSL library.

Author
Jan Benda
Version
1.0

Constructor & Destructor Documentation

RandomGSL ( const gsl_rng_type *  rt = gsl_rng_mt19937)

Construct the random number generator. There are many different random number generators available that can be passed to this class: gsl_rng_mt19937, gsl_gsl_rng_ranlxs0, gsl_rng_ranlxs1, rng_ranlxs2, gsl_rng_ranlxd1, gsl_rng_ranlxd2, gsl_rng_ranlux, gsl_rng_ranlux389, gsl_rng_cmrg, gsl_rng_mrg, gsl_rng_taus, gsl_rng_taus2, gsl_rng_gfsr4, gsl_rng_rand, gsl_rng_random_bsd, gsl_rng_random_libc5, gsl_rng_random_glibc2, gsl_rng_rand48, gsl_rng_ranf, gsl_rng_ranmar, gsl_rng_r250, gsl_rng_tt800, gsl_rng_vax, gsl_rng_transputer, gsl_rng_randu, gsl_rng_minstd, gsl_rng_uni, gsl_rng_uni32, gsl_rng_slatec, gsl_rng_zuf, gsl_rng_borosh13, gsl_rng_coveyou, gsl_rng_fishman18, gsl_rng_fishman20, gsl_rng_fishman2x, gsl_rng_knuthran2, gsl_rng_knuthran, gsl_rng_lecuyer21, gsl_rng_waterman14. See the GSL documentation for details.

References RandomGSL::Rng, and RandomGSL::setSeed().

RandomGSL ( unsigned long  seed,
const gsl_rng_type *  rt = gsl_rng_mt19937 
)

This constructor creates a random number generator with a specified seed.

References RandomGSL::Rng, and RandomGSL::setSeed().

~RandomGSL ( void  )
virtual

References RandomGSL::Rng.

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.

References RandomGSL::Rng.

Referenced by OutData::bandNoiseWave(), OutData::noiseWave(), OutData::ouNoiseWave(), and RandomGSL::RandomGSL().

unsigned long integer ( void  )
virtual

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

Implements RandomBase.

References RandomGSL::Rng.

unsigned long integer ( unsigned long int  max)
inline

Returns a uniformly distributed random integer between 0 and max exclusively. This function is NOT virtual in order to speed up computation.

unsigned long min ( void  ) const
virtual

The minimum value integer() returns.

Implements RandomBase.

References RandomGSL::Rng.

unsigned long max ( void  ) const
virtual

The maximum value integer() returns.

Implements RandomBase.

References RandomGSL::Rng.

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.

double operator() ( void  )
inline

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

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.

References RandomGSL::Rng.

double positive ( void  )
inline

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

double gaussian ( void  )
virtual

Returns a unit gaussian distributed random number.

Implements RandomBase.

References RandomGSL::Rng.

double gaussian ( double  sigma)
inline

Returns a gaussian distributed random number with standard deviation sigma.

double exponential ( void  )
virtual

Returns an exponential distributed random number with mean one.

Reimplemented from RandomBase.

References RandomGSL::Rng.

double exponential ( double  mu)
inline

Returns an exponential distributed random number with mean mu.

double gamma ( double  a)
virtual

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

References RandomGSL::Rng.

double gamma ( double  a,
double  b 
)
inline

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

double lognormal ( double  zeta,
double  sigma 
)
inline

Returns a lognormal distributed random number p(x) dx = (1 / x sqrt(2 pi sigma^2)) exp(-(ln(x) - zeta)^2/2 sigma^2) dx.

double chisq ( double  nu)
inline

Returns a Chi-squared distributed random number p(x) dx = (1 / Gamma(nu/2)) (x/2)^(nu/2 - 1) exp(-x/2) dx

double fdist ( double  nu1,
double  nu2 
)
inline

Returns a F distributed random number.

double tdist ( double  nu)
inline

Returns a t distributed random number.

unsigned int poisson ( double  mu)
inline

Returns a Poisson distributed random number. p(k) = (mu^k / k!) exp(-mu)

int binomial ( double  p,
int  n 
)
inline

Returns a Binomial distributed random number. p(k) = (n! / k! (n-k)!) p^k (1-p)^(n-k)

string name ( void  )
virtual

The name of the random number generator.

Implements RandomBase.

References RandomGSL::Rng.

Member Data Documentation

gsl_rng* Rng
protected

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