#include <rand_num_generator.hpp>
Public Types | |
typedef boost::shared_ptr< RandNumGenerator > | RandNumGeneratorPtr |
Smart pointer that clients should use. | |
Public Member Functions | |
void | setSeed (const t_uint seed) |
Change the seed being used. | |
int | uniformInt (const int min, const int max) |
Generate an int unformly at random from the range [min,max]. | |
double | uniformZeroOne () |
Generate a real number uniformly at random between [0,1). | |
double | uniformReal (const double min, const double max) |
Generate a real number uniformly at random between [min,max). | |
double | exponential (const double lambda) |
Generate a random number from an exponential distribution. | |
double | normalDistribution (const double mean, const double sigma) |
Generate a random number from a normal distributin. | |
Static Public Member Functions | |
static RandNumGeneratorPtr | create () |
A factory method to ensure that all objects are created via new since we are using smart pointers. | |
Friends | |
ostream & | operator<< (ostream &s, const RandNumGenerator &randNumGenerator) |
Make the output operator a friend for direct access to class state. |
Uses the singleton design pattern.
Definition at line 18 of file rand_num_generator.hpp.
double RandNumGenerator::exponential | ( | const double | lambda | ) | [inline] |
Generate a random number from an exponential distribution.
lambda | the expected value of the distribution. |
Definition at line 145 of file rand_num_generator.hpp.
double RandNumGenerator::normalDistribution | ( | const double | mean, | |
const double | sigma | |||
) | [inline] |
Generate a random number from a normal distributin.
mean | the mean of the distribution. | |
sigma | the standard deviation of the distribution. |
Definition at line 155 of file rand_num_generator.hpp.
void RandNumGenerator::setSeed | ( | const t_uint | seed | ) | [inline] |
Change the seed being used.
seed | the new seed. |
Definition at line 113 of file rand_num_generator.hpp.
int RandNumGenerator::uniformInt | ( | const int | min, | |
const int | max | |||
) | [inline] |
Generate an int unformly at random from the range [min,max].
min | the minimum value that can be returned. | |
max | the maximum value that can be returned. |
Definition at line 119 of file rand_num_generator.hpp.
double RandNumGenerator::uniformReal | ( | const double | min, | |
const double | max | |||
) | [inline] |
Generate a real number uniformly at random between [min,max).
min | the minimum value that can be returned (inclusive). | |
max | the maximum value that can be returned (exclusive). |
Definition at line 135 of file rand_num_generator.hpp.
double RandNumGenerator::uniformZeroOne | ( | ) | [inline] |
Generate a real number uniformly at random between [0,1).
Definition at line 128 of file rand_num_generator.hpp.