Add a fast non-cryptographic PRNG.
This commit is contained in:
parent
c6dd5b239f
commit
3e49337d9a
10 changed files with 107 additions and 20 deletions
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue