38 #if defined(VL_PLATFORM_WINDOWS) 47 VL_DEBUG_SET_OBJECT_NAME()
48 #if defined(_MSC_VER) || defined(__MINGW32__) 50 if( !CryptAcquireContext( (HCRYPTPROV*)&hCryptProv,
NULL,
NULL, PROV_RSA_FULL, 0) )
52 #elif defined(__GNUG__) && !defined(__MINGW32__) 53 mDefURandom = fopen(
"/dev/urandom",
"rb");
59 #if defined(_MSC_VER) || defined(__MINGW32__) 62 CryptReleaseContext( (HCRYPTPROV)hCryptProv, 0 );
65 #elif defined(__GNUG__) && !defined(__MINGW32__) 76 #if defined(_MSC_VER) || defined(__MINGW32__) 77 if( !(hCryptProv && CryptGenRandom( (HCRYPTPROV)hCryptProv, bytes, (BYTE*)ptr)) )
84 #elif defined(__GNUG__) && !defined(__MINGW32__) 85 if ( mDefURandom && fread(ptr, 1, bytes, mDefURandom) == bytes )
100 unsigned int rnd = 0;
102 unsigned char* cptr = (
unsigned char*)ptr;
103 memset(cptr, 0, bytes);
104 for (
size_t i=0; i<bytes; ++i)
107 cptr[i] ^= (rnd>>0) & 0xFF;
108 cptr[i] ^= (rnd>>8) & 0xFF;
109 cptr[i] ^= (rnd>>16) & 0xFF;
110 cptr[i] ^= (rnd>>12) & 0xFF;
void fillRandomMersenneTwister(void *ptr, size_t bytes) const
Fills the specified buffer with random data generated using a defMersienneTwister().
virtual ~Random()
Destructor.
Visualization Library main namespace.
virtual bool fillRandom(void *ptr, size_t bytes) const
Fills the specified buffer with random data generated using the best quality random number generation...
VLCORE_EXPORT MersenneTwister * defMersenneTwister()