Add a fast non-cryptographic PRNG.

This commit is contained in:
Adam Ierymenko 2013-07-13 13:26:27 -04:00
parent c6dd5b239f
commit 3e49337d9a
10 changed files with 107 additions and 20 deletions

View file

@ -86,18 +86,6 @@ public:
*/
static void getSecureRandom(void *buf,unsigned int bytes);
/**
* @tparam T Integer type to fill and return
* @return Random int using secure random source
*/
template<typename T>
static inline T randomInt()
{
T foo = 0; // prevents valgrind warnings
getSecureRandom(&foo,sizeof(foo));
return foo;
}
/**
* Set modes on a file to something secure
*