Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

gsl::random_generator Class Reference

#include <random_generator.h>

List of all members.

Public Methods

 random_generator (const random_generator &other)
 Default args reads environment variable GSL_RNG_TYPE and GSL_RNG_SEED to initialize. If these are not set the generator gsl_rng_mt19937 will be used with seed 0. More...

 random_generator (const gsl_rng_type *type=NULL, unsigned long int seed=0)
 ~random_generator ()
random_generator& operator= (const random_generator &other)
void set (unsigned long int seed)
unsigned long int get (unsigned long int n=0)
double uniform ()
double uniform_positive ()
string name ()
unsigned long int max ()
unsigned long int min ()
gsl_rng* gslobj ()
const gsl_rng* gslobj () const


Constructor & Destructor Documentation

gsl::random_generator::random_generator ( const random_generator & other ) [inline]
 

Default args reads environment variable GSL_RNG_TYPE and GSL_RNG_SEED to initialize. If these are not set the generator gsl_rng_mt19937 will be used with seed 0.

Definition at line 32 of file random_generator.h.

00032 : generator(NULL) {generator = gsl_rng_clone(other.generator);}

gsl::random_generator::random_generator ( const gsl_rng_type * type = NULL,
unsigned long int seed = 0 ) [inline]
 

Definition at line 33 of file random_generator.h.

00033                                                                                    : generator(NULL)
00034         {
00035                 gsl_rng_env_setup();
00036                 if (!type)
00037                 {
00038                         generator = gsl_rng_alloc (gsl_rng_default);
00039                 }
00040                 else 
00041                 {
00042                         generator = gsl_rng_alloc (type) ; 
00043                         if (seed)
00044                                 gsl_rng_set(generator, seed);
00045                 }
00046         }

gsl::random_generator::~random_generator ( ) [inline]
 

Definition at line 47 of file random_generator.h.

00047 {gsl_rng_free(generator);}


Member Function Documentation

unsigned long int gsl::random_generator::get ( unsigned long int n = 0 ) [inline]
 

Definition at line 52 of file random_generator.h.

00052 {if (n) return gsl_rng_uniform_int(generator, n); else return gsl_rng_get(generator);}

const gsl_rng * gsl::random_generator::gslobj ( ) const [inline]
 

Definition at line 63 of file random_generator.h.

00063 { return generator;}

gsl_rng * gsl::random_generator::gslobj ( ) [inline]
 

Definition at line 62 of file random_generator.h.

00062 { return generator;}

unsigned long int gsl::random_generator::max ( ) [inline]
 

Definition at line 58 of file random_generator.h.

00058 {return gsl_rng_max(generator);}

unsigned long int gsl::random_generator::min ( ) [inline]
 

Definition at line 59 of file random_generator.h.

00059 {return gsl_rng_min(generator);}

string gsl::random_generator::name ( ) [inline]
 

Definition at line 57 of file random_generator.h.

00057 {return gsl_rng_name(generator);}

random_generator & gsl::random_generator::operator= ( const random_generator & other ) [inline]
 

Definition at line 48 of file random_generator.h.

00048 {if (generator) gsl_rng_free(generator); generator = gsl_rng_clone(other.generator);return *this;}

void gsl::random_generator::set ( unsigned long int seed ) [inline]
 

Definition at line 49 of file random_generator.h.

00049 {gsl_rng_set(generator, seed);}

double gsl::random_generator::uniform ( ) [inline]
 

Definition at line 53 of file random_generator.h.

00053 { return gsl_rng_uniform(generator);}

double gsl::random_generator::uniform_positive ( ) [inline]
 

Definition at line 54 of file random_generator.h.

00054 { return gsl_rng_uniform_pos(generator);}


The documentation for this class was generated from the following file:
Generated at Sun Dec 16 23:44:45 2001 for gslwrap by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001