Public Types | Public Member Functions | Protected Attributes | List of all members
o2scl::rng_gsl Class Reference

Random number generator (GSL) More...

#include <rng_gsl.h>

Inheritance diagram for o2scl::rng_gsl:

Public Types

typedef unsigned long int result_type

Public Member 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.
const gsl_rng_type * get_type ()
 Return generator type.
result_type operator() ()
 Return a random number in $(0,1]$.
double random ()
 Return a random number in $(0,1]$.
double entropy ()
 Return the entropy (0.0 since not applicable for pseudo-random engines.
unsigned long int max ()
 Return the maximum integer for random_int()
unsigned long int min ()
 Return the minimum integer for random_int()
unsigned long int random_int (unsigned long int n=0)
 Return random integer in $[0,\mathrm{max}-1]$.
void set_seed (unsigned long int s)
 Set the seed.
void clock_seed ()
 Set the seed.
rng_gsloperator= (const rng_gsl &rg)
 Copy constructor with equals operator.
 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.

Detailed Description

This object is built on the gsl_rng struct and modeled to look like a std::random_device object.

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 will likely be completely replaced by the random number generators in the standard library.

Definition at line 55 of file rng_gsl.h.

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

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).