ARGoS  3
A parallel, multi-engine simulator for swarm robotics
argos::CRandom::CRNG Class Reference

The RNG. More...

#include <rng.h>

List of all members.

Public Member Functions

 CRNG (UInt32 un_seed, const std::string &str_type="mt19937")
 Class constructor.
 CRNG (const CRNG &c_rng)
 Class copy constructor.
virtual ~CRNG ()
 Class destructor.
UInt32 GetSeed () const throw ()
 Returns the seed of this RNG.
void SetSeed (UInt32 un_seed) throw ()
 Sets the seed of this RNG.
std::string GetType () const throw ()
 Returns the type of this RNG.
void SetType (const std::string &str_type)
 Sets the type of this RNG.
void Reset ()
 Reset the RNG.
bool Bernoulli (Real f_true=0.5)
 Returns a random value from a Bernoulli distribution.
CRadians Uniform (const CRange< CRadians > &c_range)
 Returns a random value from a uniform distribution.
Real Uniform (const CRange< Real > &c_range)
 Returns a random value from a uniform distribution.
SInt32 Uniform (const CRange< SInt32 > &c_range)
 Returns a random value from a uniform distribution.
UInt32 Uniform (const CRange< UInt32 > &c_range)
 Returns a random value from a uniform distribution.
Real Exponential (Real f_mean)
 Returns a random value from an exponential distribution.
Real Gaussian (Real f_std_dev, Real f_mean=0.0f)
 Returns a random value from a Gaussian distribution.
Real Rayleigh (Real f_sigma)
 Returns a random value from a Rayleigh distribution.
Real Lognormal (Real f_sigma, Real f_mu)
 Returns a random value from a Lognormal distribution.

Detailed Description

The RNG.

This class is the real random number generator. You need an instance of this class to be able to generate random numbers.

Definition at line 97 of file rng.h.


Constructor & Destructor Documentation

argos::CRandom::CRNG::CRNG ( UInt32  un_seed,
const std::string &  str_type = "mt19937" 
)

Class constructor.

To create a new RNG from user code, never use this method. Use CreateRNG() instead.

Parameters:
un_seedthe seed of the RNG.
str_typethe type of RNG to use. By default, Mersenne Twister is used. For a list of available RNG types, see GetRNGTypes().

Definition at line 42 of file rng.cpp.

argos::CRandom::CRNG::CRNG ( const CRNG c_rng)

Class copy constructor.

To create a new RNG from user code, never use this method. Use CreateRNG() instead.

Definition at line 57 of file rng.cpp.

Class destructor.

Definition at line 84 of file rng.cpp.


Member Function Documentation

bool argos::CRandom::CRNG::Bernoulli ( Real  f_true = 0.5)

Returns a random value from a Bernoulli distribution.

Parameters:
f_truethe probability to return a 1.
Returns:
a random value from a Bernoulli distribution (true/false).

Definition at line 155 of file rng.cpp.

Returns a random value from an exponential distribution.

Parameters:
f_meanthe mean of the exponential distribution.
Returns:
a random value from an exponential distribution.

Definition at line 238 of file rng.cpp.

Real argos::CRandom::CRNG::Gaussian ( Real  f_std_dev,
Real  f_mean = 0.0f 
)

Returns a random value from a Gaussian distribution.

Parameters:
f_std_devthe standard deviation of the Gaussian distribution.
f_meanthe mean of the Gaussian distribution.
Returns:
a random value from the Gaussian distribution.

Definition at line 250 of file rng.cpp.

UInt32 argos::CRandom::CRNG::GetSeed ( ) const throw () [inline]

Returns the seed of this RNG.

Returns:
the seed of this RNG.

Definition at line 125 of file rng.h.

std::string argos::CRandom::CRNG::GetType ( ) const throw () [inline]

Returns the type of this RNG.

Returns:
the type of this RNG.

Definition at line 143 of file rng.h.

Real argos::CRandom::CRNG::Lognormal ( Real  f_sigma,
Real  f_mu 
)

Returns a random value from a Lognormal distribution.

Parameters:
f_sigmaparameter sigma of the distribution
f_muparameter mu of the distribution
Returns:
a random value from the Lognormal distribution.

Definition at line 294 of file rng.cpp.

Returns a random value from a Rayleigh distribution.

Parameters:
f_sigmaparameter sigma of the distribution
Returns:
a random value from the Rayleigh distribution.

Definition at line 273 of file rng.cpp.

Reset the RNG.

Reset the RNG to the current seed value.

Definition at line 144 of file rng.cpp.

void argos::CRandom::CRNG::SetSeed ( UInt32  un_seed) throw () [inline]

Sets the seed of this RNG.

This method does not reset the RNG. You must call Reset() explicitly.

Parameters:
un_seedthe new seed for this RNG.
See also:
Reset()

Definition at line 135 of file rng.h.

void argos::CRandom::CRNG::SetType ( const std::string &  str_type) [inline]

Sets the type of this RNG.

Parameters:
str_typethe new type for this RNG.

Definition at line 151 of file rng.h.

Returns a random value from a uniform distribution.

Parameters:
c_rangethe range of values to draw one from.
Returns:
a random value from the range [min,max).

Definition at line 168 of file rng.cpp.

Real argos::CRandom::CRNG::Uniform ( const CRange< Real > &  c_range)

Returns a random value from a uniform distribution.

Parameters:
c_rangethe range of values to draw one from.
Returns:
a random value from the range [min,max).

Definition at line 183 of file rng.cpp.

Returns a random value from a uniform distribution.

Parameters:
c_rangethe range of values to draw one from.
Returns:
a random value from the range [min,max).

Definition at line 198 of file rng.cpp.

Returns a random value from a uniform distribution.

Parameters:
c_rangethe range of values to draw one from.
Returns:
a random value from the range [min,max).

Definition at line 218 of file rng.cpp.


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