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

@ -115,11 +115,12 @@ public:
/**
* Clear a random bit in this bloom filter
*
* @param rn Random number
*/
inline void decay()
inline void decay(unsigned int rn)
throw()
{
const unsigned int rn = Utils::randomInt<unsigned int>();
_field[(rn >> 3) % (B / 8)] &= ~((unsigned char)(1 << (rn & 7)));
}