Common::GaRandomBool Class Reference

GaRandomBool class generates random boolean values. It supports generating boolean with defined probabilities of true and false states. The class implements GaRandom interface. This class has no built-in synchronizator, so LOCK_OBJECT and LOCK_THIS_OBJECT macros cannot be used with instances of this class, but all public methods are thread-safe. More...

#include <D:/Temp/vs/gal/source/Random.h>

Inherits Common::GaRandom< bool >.

List of all members.

Public Member Functions

 GaRandomBool ()
 This constructor initializes random generator with current time as seed.
 GaRandomBool (unsigned long seed)
 This constructor initialize random generator with user-defined seed.
virtual bool GACALL Generate ()
 This method generates random Boolean values.
virtual bool GACALL Generate (const bool &max)
 This method generates random Boolean values.
virtual bool GACALL Generate (const bool &min, const bool &max)
 This method generates random Boolean values.
bool GACALL Generate (double p)
 This method generates Boolean value with p probability of true value.
bool GACALL Generate (int p)
 This method generates Boolean value with p probability of true and 100-p of false value.

Private Attributes

GaRandomGenerator _generator
 Instance of algorithm for generating random numbers.


Detailed Description

GaRandomBool class generates random boolean values. It supports generating boolean with defined probabilities of true and false states. The class implements GaRandom interface. This class has no built-in synchronizator, so LOCK_OBJECT and LOCK_THIS_OBJECT macros cannot be used with instances of this class, but all public methods are thread-safe.


Constructor & Destructor Documentation

Common::GaRandomBool::GaRandomBool (  )  [inline]

This constructor initializes random generator with current time as seed.

Common::GaRandomBool::GaRandomBool ( unsigned long  seed  )  [inline]

This constructor initialize random generator with user-defined seed.

Parameters:
seed user-defined seed.


Member Function Documentation

virtual bool GACALL Common::GaRandomBool::Generate (  )  [inline, virtual]

This method generates random Boolean values.

This method is thread-safe.

Returns:
Returns generate random value.

Implements Common::GaRandom< bool >.

virtual bool GACALL Common::GaRandomBool::Generate ( const bool &  max  )  [inline, virtual]

This method generates random Boolean values.

This method is thread-safe.

Parameters:
max this parameter is ignored.
Returns:
Returns generate random value.

Implements Common::GaRandom< bool >.

virtual bool GACALL Common::GaRandomBool::Generate ( const bool &  min,
const bool &  max 
) [inline, virtual]

This method generates random Boolean values.

This method is thread-safe.

Parameters:
min this parameter is ignored.
max this parameter is ignored.
Returns:
Returns generate random value.

Implements Common::GaRandom< bool >.

bool GACALL Common::GaRandomBool::Generate ( double  p  )  [inline]

This method generates Boolean value with p probability of true value.

This method is thread safe.

Parameters:
p probability of true value (0, 1).
Returns:
Returns generate random value.

bool GACALL Common::GaRandomBool::Generate ( int  p  )  [inline]

This method generates Boolean value with p probability of true and 100-p of false value.

This method is thread safe.

Parameters:
p probability in percents of true value (0 - 100).
Returns:
Returns generate random value.


Member Data Documentation

Instance of algorithm for generating random numbers.


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

Genetic Algorithm Library
Coolsoft Software Development