3#include <xrpl/beast/utility/instrumentation.h>
4#include <xrpl/beast/xor_shift_engine.h>
15#ifndef __INTELLISENSE__
20 "The XRPL default PRNG engine must return an unsigned integral type.");
26 "The XRPL default PRNG engine return must be at least 64 bits wide.");
33template <
class Engine,
class Result =
typename Engine::result_type>
66 seed = distribution(kSeeder);
94template <
class Engine,
class Integral>
96randInt(Engine& engine, Integral min, Integral max)
98 XRPL_ASSERT(max > min,
"xrpl::randInt : max over min inputs");
106template <
class Integral>
113template <
class Engine,
class Integral>
117 return randInt(engine, Integral(0), max);
120template <
class Integral>
127template <
class Integral,
class Engine>
134template <
class Integral =
int>
144template <
class Byte,
class Engine>
147 detail::is_engine<Engine>::value,
155template <
class Byte = std::u
int8_t>
165template <
class Engine>
169 return randInt(engine, 1) == 1;
detail::XorShiftEngine<> xor_shift_engine
XOR-shift Generator.
std::is_invocable_r< Result, Engine > is_engine
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::enable_if_t<(std::is_same_v< Byte, unsigned char >||std::is_same_v< Byte, std::uint8_t >), Byte > randByte()
std::enable_if_t< std::is_integral_v< Integral >, Integral > randInt()
beast::xor_shift_engine & defaultPrng()
Return the default random engine.