Visualization LibraryA lightweight C++ OpenGL middleware for 2D/3D graphics |
[Home] [Tutorials] [All Classes] [Grouped Classes] |
Random number generator. More...
#include <Random.hpp>
Public Member Functions | |
| virtual const char * | className () |
| Returns the name of the class. | |
| Random () | |
| Constructor. | |
| virtual | ~Random () |
| Destructor. | |
| virtual bool | fillRandom (void *ptr, size_t bytes) const |
| Fills the specified buffer with random data generated using the best quality random number generation facilities provided by the operating system. | |
Static Public Member Functions | |
| static void | standardFillRandom (void *ptr, size_t bytes) |
| Fills the specified buffer with random data generated using the standard rand() function. | |
| static void | standardRandomize () |
| Initializes the standard rand() random number generator using srand() with a reasonably unprobable value, based on the current time stamp and memory state. | |
Random number generator.
Definition at line 40 of file Random.hpp.
| Random::Random | ( | ) |
| Random::~Random | ( | ) | [virtual] |
Destructor.
Definition at line 57 of file Random.cpp.
| virtual const char* vl::Random::className | ( | ) | [inline, virtual] |
Returns the name of the class.
Reimplemented from vl::Object.
Definition at line 43 of file Random.hpp.
| bool Random::fillRandom | ( | void * | ptr, |
| size_t | bytes | ||
| ) | const [virtual] |
Fills the specified buffer with random data generated using the best quality random number generation facilities provided by the operating system.
Under Windows (including MinGW) CryptGenRandom is used, while under Unix-like operating systems /dev/urandom is used. If no special random number generation facility is detected the function falls back to standardFillRandom().
false if the function had to fallback to standardFillRandom() otherwise returns true. Definition at line 65 of file Random.cpp.
References standardFillRandom().
Referenced by vl::UUID::generateVersion4().
| void Random::standardFillRandom | ( | void * | ptr, |
| size_t | bytes | ||
| ) | [static] |
Fills the specified buffer with random data generated using the standard rand() function.
The method fillRandom() falls back to this function if no other high quality random number generation mechanism is detected.
Definition at line 93 of file Random.cpp.
References vl::Log::warning().
Referenced by fillRandom().
| void Random::standardRandomize | ( | ) | [static] |
Initializes the standard rand() random number generator using srand() with a reasonably unprobable value, based on the current time stamp and memory state.
Definition at line 109 of file Random.cpp.
References vl::Time::dayOfMonth(), vl::Time::hour(), vl::Time::microsecond(), vl::Time::minute(), vl::Time::month(), vl::Time::second(), and vl::Time::year().