MT Core (C++)
Core library for replacing C++ standard in project usage
Loading...
Searching...
No Matches
Prng

Psuedo Random Number Generation routines (PRNGs) More...

Classes

struct  mtcore::PrngState
 Internal PRNG state. More...
 
struct  mtcore::PrngVTable
 V-Table for PRNG Designed for having a simple PRNG implementation. More...
 
struct  mtcore::Prng
 Represents a Pseudo Random Number Generator. More...
 

Functions

Prng mtcore::tinymt_init (uint64_t seed) noexcept
 Initializes a PRNG based on the TinyMT variant of Mersenne Twister.
 
Prng mtcore::lcg_init (uint64_t seed) noexcept
 Initializes a Linear Congruential Generator NOTE: THIS IS NOT A GOOD PRNG (it's essentially rand())
 
Result< Prng, Mt19937_64Errormtcore::mt19937_64 (Allocator *alloc, uint64_t seed) noexcept
 Initializes a Mersenne Twister 19937-64 algorithm Note: This does require allocated memory.
 

Detailed Description

Psuedo Random Number Generation routines (PRNGs)

Function Documentation

◆ lcg_init()

Prng mtcore::lcg_init ( uint64_t seed)
noexcept

Initializes a Linear Congruential Generator NOTE: THIS IS NOT A GOOD PRNG (it's essentially rand())

Parameters
seedInitial seed to use
Returns
PRNG to use

◆ mt19937_64()

Result< Prng, Mt19937_64Error > mtcore::mt19937_64 ( Allocator * alloc,
uint64_t seed )
noexcept

Initializes a Mersenne Twister 19937-64 algorithm Note: This does require allocated memory.

Parameters
allocPointer to an allocator to use. Must be memory stable (will be used throughout lifetime of PRNG)
seedInitial seed to use
Returns
PRNG to use

◆ tinymt_init()

Prng mtcore::tinymt_init ( uint64_t seed)
noexcept

Initializes a PRNG based on the TinyMT variant of Mersenne Twister.

Parameters
seedInitial seed to use
Returns
PRNG to use