Class holding a random generator. More...
#include <stdair/basic/RandomGeneration.hpp>
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_T & | getBaseGenerator () |
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 |
Class holding a random generator.
Definition at line 17 of file RandomGeneration.hpp.
stdair::RandomGeneration::RandomGeneration | ( | const RandomSeed_T & | iSeed | ) |
Main constructor.
Definition at line 27 of file RandomGeneration.cpp.
stdair::RandomGeneration::RandomGeneration | ( | ) |
Default constructor.
Definition at line 23 of file RandomGeneration.cpp.
stdair::RandomGeneration::~RandomGeneration | ( | ) |
Destructor.
Definition at line 37 of file RandomGeneration.cpp.
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()().
|
inline |
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.
|
inline |
Retrieve the base generator for initialising other random generators.
Definition at line 56 of file RandomGeneration.hpp.
References _generator.
|
virtual |
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.
|
inlineinherited |
Dump a Business Object into an output stream.
ostream& | the output stream. |
Definition at line 29 of file StructAbstract.hpp.
References stdair::StructAbstract::describe().
|
inlinevirtualinherited |
Read a Business Object from an input stream.
istream& | the input stream. |
Reimplemented in stdair::BookingRequestStruct, stdair::EventStruct, stdair::TravelSolutionStruct, stdair::VirtualClassStruct, stdair::ConfigHolderStruct, stdair::FareOptionStruct, stdair::OptimisationNotificationStruct, stdair::ProgressStatusSet, stdair::YieldRange, stdair::CancellationStruct, stdair::AirlineStruct, stdair::RMEventStruct, stdair::SnapshotStruct, stdair::FFDisutilityCurveHolderStruct, stdair::FRAT5CurveHolderStruct, and stdair::BreakPointStruct.
Definition at line 38 of file StructAbstract.hpp.
Referenced by operator>>().
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().