GaRandomInteger
class generates random 32-bits wide integer numbers. 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< int >.
Public Member Functions | |
GaRandomInteger () | |
This constructor initializes random generator with current time as seed. | |
GaRandomInteger (unsigned long seed) | |
This constructor initialize random generator with user-defined seed. | |
virtual int GACALL | Generate () |
This method generates random values in interval(0, 2147483647). | |
virtual int GACALL | Generate (const int &max) |
This method generates random values in interval(0, max ). | |
virtual int GACALL | Generate (const int &min, const int &max) |
This method generates random values in interval(min , max ). | |
Private Attributes | |
GaRandomGenerator | _generator |
Instance of algorithm for generating random numbers. |
GaRandomInteger
class generates random 32-bits wide integer numbers. 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.
Common::GaRandomInteger::GaRandomInteger | ( | ) | [inline] |
This constructor initializes random generator with current time as seed.
Common::GaRandomInteger::GaRandomInteger | ( | unsigned long | seed | ) | [inline] |
This constructor initialize random generator with user-defined seed.
seed | user-defined seed. |
virtual int GACALL Common::GaRandomInteger::Generate | ( | ) | [inline, virtual] |
This method generates random values in interval(0, 2147483647).
This method is thread-safe.
Implements Common::GaRandom< int >.
virtual int GACALL Common::GaRandomInteger::Generate | ( | const int & | max | ) | [inline, virtual] |
This method generates random values in interval(0, max
).
This method is thread-safe.
max | maximal value which can be generated. |
Implements Common::GaRandom< int >.
virtual int GACALL Common::GaRandomInteger::Generate | ( | const int & | min, | |
const int & | max | |||
) | [inline, virtual] |
This method generates random values in interval(min
, max
).
This method is thread-safe.
min | minimal value which can be generated. | |
max | maximal value which can be generated. |
Implements Common::GaRandom< int >.
Instance of algorithm for generating random numbers.