libdonut  2.3.2
Application framework for cross-platform game development in C++20
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
donut::random::Xoroshiro128PlusPlusEngine Class Reference

Implementation of the xoroshiro128++ pseudorandom number generator that provides the API required for a standard uniform random bit generator, so that it can be plugged into any of the random number distributions provided by the standard library. More...

#include <donut/random.hpp>

Public Types

using result_type = std::uint64_t
 

Public Member Functions

constexpr Xoroshiro128PlusPlusEngine () noexcept
 
constexpr Xoroshiro128PlusPlusEngine (result_type value) noexcept
 
constexpr void seed (result_type value=default_seed) noexcept
 
constexpr result_type operator() () noexcept
 
constexpr void discard (unsigned long long z) noexcept
 
constexpr void jump () noexcept
 Advance the internal state 2^64 times. More...
 
constexpr void longJump () noexcept
 Advance the internal state 2^96 times. More...
 
constexpr bool operator== (const Xoroshiro128PlusPlusEngine &other) const noexcept
 

Static Public Member Functions

static constexpr result_type min ()
 
static constexpr result_type max ()
 

Static Public Attributes

static constexpr result_type default_seed = SplitMix64Engine::default_seed
 

Friends

template<typename CharT , typename Traits >
std::basic_ostream< CharT, Traits > & operator<< (std::basic_ostream< CharT, Traits > &stream, const Xoroshiro128PlusPlusEngine &engine)
 
template<typename CharT , typename Traits >
std::basic_istream< CharT, Traits > & operator>> (std::basic_istream< CharT, Traits > &stream, Xoroshiro128PlusPlusEngine &engine)
 

Detailed Description

Implementation of the xoroshiro128++ pseudorandom number generator that provides the API required for a standard uniform random bit generator, so that it can be plugged into any of the random number distributions provided by the standard library.

This engine is small, fast and fairly high quality compared to most of the pseudorandom number generators in the standard library.

Warning
This engine does not produce cryptographcially secure randomness and should not be used for such purposes.
See also
https://prng.di.unimi.it/ for more information.

Member Typedef Documentation

◆ result_type

Constructor & Destructor Documentation

◆ Xoroshiro128PlusPlusEngine() [1/2]

constexpr donut::random::Xoroshiro128PlusPlusEngine::Xoroshiro128PlusPlusEngine ( )
inlineconstexprnoexcept

◆ Xoroshiro128PlusPlusEngine() [2/2]

constexpr donut::random::Xoroshiro128PlusPlusEngine::Xoroshiro128PlusPlusEngine ( result_type  value)
inlineexplicitconstexprnoexcept

Member Function Documentation

◆ min()

static constexpr result_type donut::random::Xoroshiro128PlusPlusEngine::min ( )
inlinestaticconstexpr

◆ max()

static constexpr result_type donut::random::Xoroshiro128PlusPlusEngine::max ( )
inlinestaticconstexpr

◆ seed()

constexpr void donut::random::Xoroshiro128PlusPlusEngine::seed ( result_type  value = default_seed)
inlineconstexprnoexcept

◆ operator()()

constexpr result_type donut::random::Xoroshiro128PlusPlusEngine::operator() ( )
inlineconstexprnoexcept

◆ discard()

constexpr void donut::random::Xoroshiro128PlusPlusEngine::discard ( unsigned long long  z)
inlineconstexprnoexcept

◆ jump()

constexpr void donut::random::Xoroshiro128PlusPlusEngine::jump ( )
inlineconstexprnoexcept

Advance the internal state 2^64 times.

◆ longJump()

constexpr void donut::random::Xoroshiro128PlusPlusEngine::longJump ( )
inlineconstexprnoexcept

Advance the internal state 2^96 times.

◆ operator==()

constexpr bool donut::random::Xoroshiro128PlusPlusEngine::operator== ( const Xoroshiro128PlusPlusEngine other) const
inlineconstexprnoexcept

Friends And Related Function Documentation

◆ operator<<

template<typename CharT , typename Traits >
std::basic_ostream<CharT, Traits>& operator<< ( std::basic_ostream< CharT, Traits > &  stream,
const Xoroshiro128PlusPlusEngine engine 
)
friend

◆ operator>>

template<typename CharT , typename Traits >
std::basic_istream<CharT, Traits>& operator>> ( std::basic_istream< CharT, Traits > &  stream,
Xoroshiro128PlusPlusEngine engine 
)
friend

Member Data Documentation

◆ default_seed

constexpr result_type donut::random::Xoroshiro128PlusPlusEngine::default_seed = SplitMix64Engine::default_seed
staticconstexpr

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