Class rng_gsl (o2scl)

O2scl : Class List

class o2scl::rng_gsl : public gsl_rng

Random number generator (GSL)

If seed is zero, or is not given, then the default seed specific to the particular random number generator is used.

Idea for Future:

This is being replaced by o2scl::rng now that C++11 support is more widespread.

Public Types

typedef unsigned long int result_type

Desc.

Public Functions

rng_gsl(const gsl_rng_type *gtype = gsl_rng_mt19937)

Initialize the random number generator with type gtype and the default seed.

rng_gsl(unsigned long int seed, const gsl_rng_type *gtype = gsl_rng_mt19937)

Initialize the random number generator with seed.

~rng_gsl()
inline const gsl_rng_type *get_type()

Return generator type.

inline result_type operator()()

Return a random number in \((0,1]\).

inline double random()

Return a random number in \((0,1]\).

inline double entropy()

Return the entropy (0.0 since not applicable for pseudo-random engines.

inline unsigned long int max()

Return the maximum integer for random_int()

inline unsigned long int min()

Return the minimum integer for random_int()

unsigned long int random_int(unsigned long int max = 0)

Return random integer in \([0,\mathrm{max}-1]\).

inline void set_seed(unsigned long int s)

Set the seed.

inline unsigned long int get_seed()

Get the seed.

inline void clock_seed()

Set the seed.

inline rng_gsl &operator=(const rng_gsl &rg)

Copy constructor with equals operator.

inline rng_gsl(const rng_gsl &rg)

Copy constructor.

Protected Attributes

unsigned long int seed

The seed.

const gsl_rng_type *rng

The GSL random number generator type.