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

#include <base/Random.h>

Static Public Member Functions

static RandomInputStreamgetRandomInputStream () noexcept
 
static void fill (uint8 *dest, const uint8 *end) noexcept
 
template<typename TYPE , MemorySize SIZE>
static void fill (TYPE(&buffer)[SIZE]) noexcept
 
template<typename TYPE >
static TYPE random () noexcept
 
static unsigned int randomDirect () noexcept
 
template<>
int8 random () noexcept
 
template<>
int16 random () noexcept
 
template<>
int32 random () noexcept
 
template<>
int64 random () noexcept
 
template<>
int128 random () noexcept
 
template<>
uint8 random () noexcept
 
template<>
uint16 random () noexcept
 
template<>
uint32 random () noexcept
 
template<>
unsigned long random () noexcept
 
template<>
unsigned long long random () noexcept
 
template<>
uint128 random () noexcept
 

Detailed Description

MT-safe random generator.

Version
1.0

Member Function Documentation

◆ fill() [1/2]

template<typename TYPE , MemorySize SIZE>
static void Random::fill ( TYPE(&)  buffer[SIZE])
inlinestaticnoexcept

Fills fixed size array.

◆ fill() [2/2]

static void Random::fill ( uint8 *  dest,
const uint8 *  end 
)
staticnoexcept

Fills given buffer.

◆ getRandomInputStream()

static RandomInputStream& Random::getRandomInputStream ( )
staticnoexcept

Returns thread local random input stream. Do not preserve source outside of execution scope.

◆ random()

template<typename TYPE >
static TYPE Random::random ( )
staticnoexcept

Returns a random number for the given primitive of type int8, int16, int32, int64, int128, uint8, uint16, uint32, uint64, and uint128.

◆ randomDirect()

static unsigned int Random::randomDirect ( )
staticnoexcept

Returns a random number without using Mersenne Twister for the given primitive of type int8, int16, int32, int64, int128, uint8, uint16, uint32, uint64, and uint128.