RandNumGenerator Class Reference

Handles the generation of random numbers from several distributions. More...

#include <rand_num_generator.hpp>

List of all members.

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.


Detailed Description

Handles the generation of random numbers from several distributions.

Uses the singleton design pattern.

Definition at line 18 of file rand_num_generator.hpp.


Member Function Documentation

double RandNumGenerator::exponential ( const double  lambda  )  [inline]

Generate a random number from an exponential distribution.

Parameters:
lambda the expected value of the distribution.
Returns:
a double from an exponential 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.

Parameters:
mean the mean of the distribution.
sigma the standard deviation of the distribution.
Returns:
a double from a normal distribution.

Definition at line 155 of file rand_num_generator.hpp.

void RandNumGenerator::setSeed ( const t_uint  seed  )  [inline]

Change the seed being used.

Parameters:
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].

Parameters:
min the minimum value that can be returned.
max the maximum value that can be returned.
Returns:
an int in the range [min,max].

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).

Parameters:
min the minimum value that can be returned (inclusive).
max the maximum value that can be returned (exclusive).
Returns:
a double in the range [min,max).

Definition at line 135 of file rand_num_generator.hpp.

double RandNumGenerator::uniformZeroOne (  )  [inline]

Generate a real number uniformly at random between [0,1).

Returns:
a double in the range [0,1).

Definition at line 128 of file rand_num_generator.hpp.


The documentation for this class was generated from the following files:
Generated on Tue Dec 12 17:04:41 2006 for rfidsim by  doxygen 1.4.7