[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

| UniformIntRandomFunctor [Random Number Generation] |

`#include <vigra/random.hxx>`

List of all members.

## 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() (UInt32 beyond) const
UInt32 | operator() () const
| UniformIntRandomFunctor (UInt32 lower, UInt32 upper, Engine &generator=Engine::global(), bool useLowBits=true)
| UniformIntRandomFunctor (Engine &generator=Engine::global())

## Detailed Description

### template<class Engine = RandomTT800>
class vigra::UniformIntRandomFunctor< Engine >

Functor to create uniformely 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`).

## Constructor & Destructor Documentation

UniformIntRandomFunctor | ( | Engine & | generator = `Engine::global()` | ) | `[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 & | 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.

## Member Function Documentation

UInt32 operator() | ( | UInt32 | beyond | ) | const

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`.

UInt32 operator() | ( |  | ) | const

Return a random number as specified in the constructor.

The documentation for this class was generated from the following file:

- vigra/random.hxx

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany | html generated using doxygen and Python VIGRA 1.6.0 (13 Aug 2008)