StdAir Logo  1.00.0
C++ Standard Airline IT Object Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
stdair::RandomGeneration Struct Reference

Class holding a random generator. More...

#include <stdair/basic/RandomGeneration.hpp>

+ Inheritance diagram for stdair::RandomGeneration:

List of all members.

Public Member Functions

RealNumber_T generateUniform01 ()
RealNumber_T operator() ()
RealNumber_T generateUniform (const RealNumber_T &, const RealNumber_T &)
RealNumber_T generateNormal (const RealNumber_T &, const RealNumber_T &)
RealNumber_T generateExponential (const RealNumber_T &)
BaseGenerator_TgetBaseGenerator ()
const std::string describe () const
 RandomGeneration (const RandomSeed_T &)
 RandomGeneration ()
 ~RandomGeneration ()
void init (const RandomSeed_T &)
void toStream (std::ostream &ioOut) const
virtual void fromStream (std::istream &ioIn)

Public Attributes

BaseGenerator_T _generator

Detailed Description

Class holding a random generator.

Definition at line 17 of file RandomGeneration.hpp.

Constructor & Destructor Documentation

stdair::RandomGeneration::RandomGeneration ( const RandomSeed_T iSeed)

Main constructor.

Definition at line 27 of file RandomGeneration.cpp.

stdair::RandomGeneration::RandomGeneration ( )

Default constructor.

As per Boost bug #3516 ( the seed should not be set to 0 (at least on versions of Boost lower than 1.44).

Definition at line 23 of file RandomGeneration.cpp.

stdair::RandomGeneration::~RandomGeneration ( )


Definition at line 37 of file RandomGeneration.cpp.

Member Function Documentation

RealNumber_T stdair::RandomGeneration::generateUniform01 ( )

Generate a randomised number following a uniform distribution between 0 (included) and 1 (excluded).

Definition at line 53 of file RandomGeneration.cpp.

References _generator.

Referenced by generateNormal(), generateUniform(), and operator()().

RealNumber_T stdair::RandomGeneration::operator() ( )

Same as generateUniform01(). That operator is provided for convenient reasons.

Definition at line 30 of file RandomGeneration.hpp.

References generateUniform01().

RealNumber_T stdair::RandomGeneration::generateUniform ( const RealNumber_T iMinValue,
const RealNumber_T iMaxValue 

Generate a randomized number following a uniform distribution between a minimum (included) and a maximum (excluded) value.

Definition at line 59 of file RandomGeneration.cpp.

References generateUniform01().

RealNumber_T stdair::RandomGeneration::generateNormal ( const RealNumber_T mu,
const RealNumber_T sigma 

Generate a randomized number following a normal distribution specified by a mean and a standard deviation.

Definition at line 68 of file RandomGeneration.cpp.

References generateUniform01().

Referenced by stdair::BookingClass::generateDemandSamples().

RealNumber_T stdair::RandomGeneration::generateExponential ( const RealNumber_T lambda)

Generate a randomized number following an exponential distribution specified by a mean and a lambda parameter.

Definition at line 86 of file RandomGeneration.cpp.

References _generator.

BaseGenerator_T& stdair::RandomGeneration::getBaseGenerator ( )

Retrieve the base generator for initialising other random generators.

Definition at line 56 of file RandomGeneration.hpp.

References _generator.

const std::string stdair::RandomGeneration::describe ( ) const

Give a description of the structure (for display purposes).

Implements stdair::StructAbstract.

Definition at line 46 of file RandomGeneration.cpp.

References _generator.

void stdair::RandomGeneration::init ( const RandomSeed_T iSeed)

Initialise the random generator.

A uniform random number distribution is defined, which produces "real" values between 0 and 1 (0 inclusive, 1 exclusive).

Definition at line 41 of file RandomGeneration.cpp.

References _generator.

Member Data Documentation

BaseGenerator_T stdair::RandomGeneration::_generator

Random number generator engine.

The random number generator is currently based on boost::minstd_rand. Alternates are boost::mt19937, boost::ecuyer1988.

Definition at line 112 of file RandomGeneration.hpp.

Referenced by describe(), generateExponential(), generateUniform01(), getBaseGenerator(), and init().

The documentation for this struct was generated from the following files: