Base Framework
Public Types | Static Public Member Functions | List of all members
RandomLegacy Class Reference

Random number generator. More...

#include <base/math/Random.h>

Public Types

enum  Generator { MT11213A = 0, MT11213B = 1, MT19937 = 2, TT800 = 3 }
 
typedef RandomImpl::Traits< TT800 > Traits
 

Static Public Member Functions

static void randomize () noexcept
 
static void randomize (unsigned int seed) noexcept
 
static unsigned int getInteger () noexcept
 
static float getFloat () noexcept
 
static double getDouble () noexcept
 
static long double getLongDouble () noexcept
 

Detailed Description

Random number generator.

Implementation of a pseudorandom number generator. The generator in described in the paper "Mersenne Twister: A 623-dimensionally equidistributed uniform pseudorandom number generator" by Makoto Matsumoto and Takuji Nishimura. The implementation is MT-safe.

Version
1.0

Member Typedef Documentation

◆ Traits

Specifies the generator to be used.

Member Enumeration Documentation

◆ Generator

The supported generators.

Member Function Documentation

◆ getDouble()

static double RandomLegacy::getDouble ( )
inlinestaticnoexcept

Returns a random real number in the range [0;1].

◆ getFloat()

static float RandomLegacy::getFloat ( )
inlinestaticnoexcept

Returns a random real number in the range [0;1].

◆ getInteger()

static unsigned int RandomLegacy::getInteger ( )
staticnoexcept

Returns a random integer (unsigned) utilizing the full range of the type.

◆ getLongDouble()

static long double RandomLegacy::getLongDouble ( )
inlinestaticnoexcept

Returns a random real number in the range [0;1].

◆ randomize() [1/2]

static void RandomLegacy::randomize ( )
staticnoexcept

Initializes the internal state of the generator from the current time.

◆ randomize() [2/2]

static void RandomLegacy::randomize ( unsigned int  seed)
staticnoexcept

Initializes the internal state of the generator.

Parameters
seedThe desired seed (generator does not work with zero).