Visualization LibraryA lightweight C++ OpenGL middleware for 2D/3D graphics |
[Home] [Tutorials] [All Classes] [Grouped Classes] |
Cryptographic random number generator. More...
#include <Random.hpp>
Public Member Functions | |
| 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 available. | |
| void | fillRandomMersenneTwister (void *ptr, size_t bytes) const |
| Fills the specified buffer with random data generated using a defMersienneTwister(). | |
Cryptographic random number generator.
For non-ryptographic fast and high quality random number generation use vl::MersenneTwister.
Definition at line 41 of file Random.hpp.
| Random::Random | ( | ) |
Constructor.
Definition at line 45 of file Random.cpp.
References NULL, and VL_DEBUG_SET_OBJECT_NAME.
| Random::~Random | ( | ) | [virtual] |
| 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 available.
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 use a MersenneTwister.
false if the function had to fallback to MersenneTwister otherwise returns true. Definition at line 74 of file Random.cpp.
References fillRandomMersenneTwister().
Referenced by vl::UUID::generateVersion4().
| void Random::fillRandomMersenneTwister | ( | void * | ptr, |
| size_t | bytes | ||
| ) | const |
Fills the specified buffer with random data generated using a defMersienneTwister().
MersienneTwister produces high quality random number and can be much faster than fillRandom().
Definition at line 98 of file Random.cpp.
References vl::defMersenneTwister(), and vl::MersenneTwister::randInt().
Referenced by fillRandom().