[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]
UniformIntRandomFunctor< Engine > Class Template Reference |
#include <vigra/random.hxx>
Public Types | |
typedef UInt32 | argument_type |
STL required functor argument type. | |
typedef UInt32 | result_type |
STL required functor result type. | |
Public Member Functions | |
UInt32 | operator() () const |
UInt32 | operator() (UInt32 beyond) const |
UniformIntRandomFunctor (Engine const &generator=Engine::global()) | |
UniformIntRandomFunctor (UInt32 lower, UInt32 upper, Engine const &generator=Engine::global(), bool useLowBits=true) | |
Functor to create uniformly distributed integer random numbers.
This functor encapsulates the appropriate functions of the given random number Engine
(usually RandomTT800
or RandomMT19937
) in an STL-compatible interface.
Traits defined:
FunctorTraits<UniformIntRandomFunctor<Engine> >::isInitializer
and
FunctorTraits<UniformIntRandomFunctor<Engine> >::isUnaryFunctor
are true (VigraTrueType
).
|
explicit |
Create functor for uniform random integers in the range [0, 232) using the given engine.
That is, the generated numbers satisfy 0 <= i < 232.
UniformIntRandomFunctor | ( | UInt32 | lower, |
UInt32 | upper, | ||
Engine const & | generator = Engine::global() , |
||
bool | useLowBits = true |
||
) |
Create functor for uniform random integers in the range [lower
, upper
] using the given engine.
That is, the generated numbers satisfy lower
<= i <= upper
. useLowBits should be set to false
when the engine generates random numbers whose low bits are significantly less random than the high bits. This does not apply to RandomTT800
and RandomMT19937
, but is necessary for simpler linear congruential generators.
UInt32 operator() | ( | ) | const |
Return a random number as specified in the constructor.
Return a uniformly distributed integer random number in the range [0, beyond
).
That is, 0 <= i < beyond
. This is a required interface for std::random_shuffle
. It ignores the limits specified in the constructor and the flag useLowBits
.
© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) |
html generated using doxygen and Python
|