RandomLib
1.10
|
Count of leading zeros. More...
#include <RandomLib/LeadingZeros.hpp>
Public Member Functions | |
template<class Random > | |
unsigned | operator() (Random &r) const throw () |
Count of leading zeros.
Count of leading zero bits after the binary point in a real number uniformly distributed in (0,1). (This is equivalent to the geometric distribution with probability 1/2.) For example
Definition at line 34 of file LeadingZeros.hpp.
unsigned RandomLib::LeadingZeros::operator() | ( | Random & | r | ) | const |
throw | ( | ||||
) |
Return the number of zero bits after the binary point in a real number uniformly distributed in (0,1). Thus k is returned with probability 1/2k+1. Because MT19937 is not a perfect random number generator, this always returns a result in [0, 19937).
Random | the type of the random generator. |
[in,out] | r | a random generator. |
Definition at line 50 of file LeadingZeros.hpp.
References STATIC_ASSERT, and RandomLib::RandomCanonical< Generator >::width.