RandX 1.4.3
基于 xoshiro/xoroshiro 算法族的纯头文件伪随机数生成器库
载入中...
搜索中...
未找到
引擎

8 个伪随机数生成引擎(7 非 CSPRNG + 1 ChaCha20 CSPRNG) 更多...

引擎 的协作图:

命名空间

namespace  RandX::detail

class  RandX::SplitMix64
 SplitMix64 伪随机数生成器,64 位输出,周期 2^64。 更多...
struct  RandX::detail::EngineBase< Derived, ResultType, N >
class  RandX::Xoshiro256StarStar
 Xoshiro256** 伪随机数生成器,64 位输出,周期 2^256-1。 更多...
class  RandX::Xoroshiro128StarStar
 Xoroshiro128** 伪随机数生成器,64 位输出,周期 2^128-1。 更多...
class  RandX::Xoshiro128StarStar
 Xoshiro128** 伪随机数生成器,32 位输出,周期 2^128-1。 更多...
class  RandX::Xoroshiro64StarStar
 Xoroshiro64** 伪随机数生成器,32 位输出,周期 2^64-1。 更多...
class  RandX::SFC64
 SFC64(Small Fast Counter)伪随机数生成器,64 位输出,周期 >= 2^64。 更多...
class  RandX::RomuDuoJr
 RomuDuoJr 伪随机数生成器,64 位输出,周期估计 >= 2^51。 更多...
class  RandX::ChaCha20
 ChaCha20 密码学安全伪随机数生成器(CSPRNG),64 位输出,符合 RFC 8439。 更多...

类型定义

using RandX::SplitMix64::state_type = std::uint64_t
 状态类型(1×uint64)
using RandX::SplitMix64::result_type = std::uint64_t
 输出类型
using RandX::detail::EngineBase< Derived, ResultType, N >::result_type = ResultType
using RandX::detail::EngineBase< Derived, ResultType, N >::state_type = std::array<ResultType, N>
using RandX::ChaCha20::result_type = std::uint64_t
 输出类型

函数

constexpr std::uint64_t RandX::detail::RotL (const std::uint64_t x, const int s) noexcept
constexpr std::uint32_t RandX::detail::RotL (const std::uint32_t x, const int s) noexcept
template<std::size_t N>
constexpr bool RandX::detail::IsAllZero (const std::array< std::uint64_t, N > &state) noexcept
template<std::size_t N>
constexpr bool RandX::detail::IsAllZero (const std::array< std::uint32_t, N > &state) noexcept
template<typename State>
constexpr bool RandX::detail::IsValidState (const State &state) noexcept
constexpr RandX::SplitMix64::SplitMix64 (state_type state=DefaultSeed) noexcept
 以指定状态构造引擎
template<class SeedSeq>
requires (!std::same_as<std::remove_cvref_t<SeedSeq>, SplitMix64>)
constexpr RandX::SplitMix64::SplitMix64 (SeedSeq &seq)
 从 std::seed_seq 播种
constexpr result_type RandX::SplitMix64::operator() () noexcept
 生成下一个 64 位随机数
constexpr void RandX::SplitMix64::discard (unsigned long long n) noexcept
 跳过 n 个输出
template<std::size_t N>
constexpr std::array< std::uint64_t, N > RandX::SplitMix64::generateSeedSequence () noexcept
 生成 N 个高质量的 64 位种子序列
static constexpr result_type RandX::SplitMix64::min () noexcept
 输出范围下界
static constexpr result_type RandX::SplitMix64::max () noexcept
 输出范围上界
constexpr state_type RandX::SplitMix64::serialize () const noexcept
 序列化引擎状态
constexpr void RandX::SplitMix64::deserialize (state_type state) noexcept
 从状态恢复引擎
static constexpr result_type RandX::detail::EngineBase< Derived, ResultType, N >::min () noexcept
static constexpr result_type RandX::detail::EngineBase< Derived, ResultType, N >::max () noexcept
constexpr void RandX::detail::EngineBase< Derived, ResultType, N >::discard (unsigned long long z) noexcept
constexpr state_type RandX::detail::EngineBase< Derived, ResultType, N >::serialize () const noexcept
constexpr void RandX::detail::EngineBase< Derived, ResultType, N >::deserialize (const state_type &s) noexcept
 RandX::detail::EngineBase< Derived, ResultType, N >::EngineBase ()=default
constexpr RandX::detail::EngineBase< Derived, ResultType, N >::EngineBase (const state_type &state) noexcept
template<class SeedSeq>
requires (!std::same_as<std::remove_cvref_t<SeedSeq>, state_type> && !std::same_as<std::remove_cvref_t<SeedSeq>, Derived>)
constexpr RandX::detail::EngineBase< Derived, ResultType, N >::EngineBase (SeedSeq &seq)
constexpr RandX::detail::EngineBase< Derived, ResultType, N >::EngineBase (std::uint64_t seed) noexcept
template<std::size_t K>
constexpr void RandX::detail::EngineBase< Derived, ResultType, N >::jumpPoly (const ResultType(&poly)[K]) noexcept
constexpr RandX::Xoshiro256StarStar::Xoshiro256StarStar () noexcept
 < 状态类型(4×uint64)
constexpr RandX::Xoshiro256StarStar::Xoshiro256StarStar (std::uint64_t seed) noexcept
 以指定种子构造引擎
template<class SeedSeq>
requires (!std::same_as<std::remove_cvref_t<SeedSeq>, Xoshiro256StarStar>)
constexpr RandX::Xoshiro256StarStar::Xoshiro256StarStar (SeedSeq &seq)
 从 std::seed_seq 播种
constexpr RandX::Xoshiro256StarStar::Xoshiro256StarStar (state_type state) noexcept
 从状态数组直接构造
constexpr result_type RandX::Xoshiro256StarStar::operator() () noexcept
 生成下一个 64 位随机数
constexpr void RandX::Xoshiro256StarStar::jump () noexcept
 前进 2^128 步,用于创建并行子序列
constexpr void RandX::Xoshiro256StarStar::longJump () noexcept
 前进 2^192 步,用于创建更稀疏的并行子序列
constexpr RandX::Xoroshiro128StarStar::Xoroshiro128StarStar () noexcept
 < 状态类型(2×uint64)
constexpr RandX::Xoroshiro128StarStar::Xoroshiro128StarStar (std::uint64_t seed) noexcept
 以指定种子构造引擎
template<class SeedSeq>
requires (!std::same_as<std::remove_cvref_t<SeedSeq>, Xoroshiro128StarStar>)
constexpr RandX::Xoroshiro128StarStar::Xoroshiro128StarStar (SeedSeq &seq)
 从 std::seed_seq 播种
constexpr RandX::Xoroshiro128StarStar::Xoroshiro128StarStar (state_type state) noexcept
 从状态数组直接构造
constexpr result_type RandX::Xoroshiro128StarStar::operator() () noexcept
 生成下一个 64 位随机数
constexpr void RandX::Xoroshiro128StarStar::jump () noexcept
 前进 2^64 步,用于创建并行子序列
constexpr void RandX::Xoroshiro128StarStar::longJump () noexcept
 前进 2^96 步,用于创建更稀疏的并行子序列
constexpr RandX::Xoshiro128StarStar::Xoshiro128StarStar () noexcept
 < 状态类型(4×uint32)
constexpr RandX::Xoshiro128StarStar::Xoshiro128StarStar (std::uint64_t seed) noexcept
 以指定种子构造引擎
template<class SeedSeq>
requires (!std::same_as<std::remove_cvref_t<SeedSeq>, Xoshiro128StarStar>)
constexpr RandX::Xoshiro128StarStar::Xoshiro128StarStar (SeedSeq &seq)
 从 std::seed_seq 播种
constexpr RandX::Xoshiro128StarStar::Xoshiro128StarStar (state_type state) noexcept
 从状态数组直接构造
constexpr result_type RandX::Xoshiro128StarStar::operator() () noexcept
 生成下一个 32 位随机数
constexpr void RandX::Xoshiro128StarStar::jump () noexcept
 前进 2^64 步,用于创建并行子序列
constexpr void RandX::Xoshiro128StarStar::longJump () noexcept
 前进 2^96 步,用于创建更稀疏的并行子序列
constexpr RandX::Xoroshiro64StarStar::Xoroshiro64StarStar () noexcept
 < 状态类型(2×uint32)
constexpr RandX::Xoroshiro64StarStar::Xoroshiro64StarStar (std::uint64_t seed) noexcept
 以指定种子构造引擎
template<class SeedSeq>
requires (!std::same_as<std::remove_cvref_t<SeedSeq>, Xoroshiro64StarStar>)
constexpr RandX::Xoroshiro64StarStar::Xoroshiro64StarStar (SeedSeq &seq)
 从 std::seed_seq 播种
constexpr RandX::Xoroshiro64StarStar::Xoroshiro64StarStar (state_type state) noexcept
 从状态数组直接构造
constexpr result_type RandX::Xoroshiro64StarStar::operator() () noexcept
 生成下一个 32 位随机数
constexpr RandX::SFC64::SFC64 () noexcept
 < 状态类型(4×uint64)
constexpr RandX::SFC64::SFC64 (std::uint64_t seed) noexcept
 以指定种子构造引擎(SplitMix64 填充 3 状态字 + counter=1 + 12 轮预热)
template<class SeedSeq>
requires (!std::same_as<std::remove_cvref_t<SeedSeq>, SFC64>)
constexpr RandX::SFC64::SFC64 (SeedSeq &seq)
 从 std::seed_seq 播种(填充 3 状态字 + counter=1 + 12 轮预热)
constexpr RandX::SFC64::SFC64 (state_type state) noexcept
 从状态数组直接构造
constexpr result_type RandX::SFC64::operator() () noexcept
 生成下一个 64 位随机数
constexpr RandX::RomuDuoJr::RomuDuoJr () noexcept
 < 状态类型(2×uint64)
constexpr RandX::RomuDuoJr::RomuDuoJr (std::uint64_t seed) noexcept
 以指定种子构造引擎
template<class SeedSeq>
requires (!std::same_as<std::remove_cvref_t<SeedSeq>, RomuDuoJr>)
constexpr RandX::RomuDuoJr::RomuDuoJr (SeedSeq &seq)
 从 std::seed_seq 播种
constexpr RandX::RomuDuoJr::RomuDuoJr (state_type state) noexcept
 从状态数组直接构造
constexpr result_type RandX::RomuDuoJr::operator() () noexcept
 生成下一个 64 位随机数
 RandX::ChaCha20::ChaCha20 (const ChaCha20 &)=delete
ChaCha20RandX::ChaCha20::operator= (const ChaCha20 &)=delete
 RandX::ChaCha20::ChaCha20 (ChaCha20 &&other) noexcept
ChaCha20RandX::ChaCha20::operator= (ChaCha20 &&other) noexcept
 RandX::ChaCha20::~ChaCha20 () noexcept
 RandX::ChaCha20::ChaCha20 ()
 构造方式 1:从 OS 熵自动播种(密码学安全,默认)
 RandX::ChaCha20::ChaCha20 (std::uint64_t seed)
 构造方式 2:以显式 64 位种子构造
 RandX::ChaCha20::ChaCha20 (const std::uint8_t *key, std::size_t keyLen, const std::uint8_t *nonce, std::size_t nonceLen, std::uint32_t counter=0)
 构造方式 3:直接指定 key + nonce + counter(高级用法/测试复现)
result_type RandX::ChaCha20::operator() ()
 生成下一个 64 位随机数
void RandX::ChaCha20::discard (unsigned long long n)
 跳过 n 个输出
void RandX::ChaCha20::reseed ()
 从 OS 熵重新播种
static constexpr result_type RandX::ChaCha20::min () noexcept
 输出范围下界
static constexpr result_type RandX::ChaCha20::max () noexcept
 输出范围上界
template<std::same_as< std::uint32_t > Uint32>
constexpr float RandX::FloatFromBits (Uint32 i) noexcept
template<std::same_as< std::uint64_t > Uint64>
constexpr double RandX::DoubleFromBits (Uint64 i) noexcept
template<class CharT, class Traits, detail::SerializableEngine Engine>
std::basic_ostream< CharT, Traits > & RandX::operator<< (std::basic_ostream< CharT, Traits > &os, const Engine &engine)
template<class CharT, class Traits, detail::SerializableEngine Engine>
std::basic_istream< CharT, Traits > & RandX::operator>> (std::basic_istream< CharT, Traits > &is, Engine &engine)
std::uint64_t RandX::RandomSeed ()
 生成非确定性的 64 位种子
Xoshiro256StarStarRandX::DefaultEngine ()
void RandX::ResetThreadLocalEngine ()
 重新播种当前线程的默认引擎(用于 POSIX fork() 产生子进程后重置引擎状态)

变量

static constexpr int RandX::detail::EngineBase< Derived, ResultType, N >::Bits = static_cast<int>(sizeof(ResultType) * 8)
state_type RandX::detail::EngineBase< Derived, ResultType, N >::s_ {}

友元

auto RandX::SplitMix64::operator<=> (const SplitMix64 &, const SplitMix64 &)=default
auto RandX::detail::EngineBase< Derived, ResultType, N >::operator<=> (const EngineBase &, const EngineBase &)=default

详细描述

8 个伪随机数生成引擎(7 非 CSPRNG + 1 ChaCha20 CSPRNG)

类型定义说明

◆ result_type [1/3]

using RandX::ChaCha20::result_type = std::uint64_t

输出类型

◆ result_type [2/3]

template<class Derived, class ResultType, std::size_t N>
using RandX::detail::EngineBase< Derived, ResultType, N >::result_type = ResultType

◆ result_type [3/3]

using RandX::SplitMix64::result_type = std::uint64_t

输出类型

◆ state_type [1/2]

template<class Derived, class ResultType, std::size_t N>
using RandX::detail::EngineBase< Derived, ResultType, N >::state_type = std::array<ResultType, N>

◆ state_type [2/2]

using RandX::SplitMix64::state_type = std::uint64_t

状态类型(1×uint64)

函数说明

◆ ChaCha20() [1/5]

RandX::ChaCha20::ChaCha20 ( )
inline

构造方式 1:从 OS 熵自动播种(密码学安全,默认)

注解
推荐用于生产环境的密码学安全场景
函数调用图:

◆ ChaCha20() [2/5]

RandX::ChaCha20::ChaCha20 ( ChaCha20 && other)
inlinenoexcept
函数调用图:

◆ ChaCha20() [3/5]

RandX::ChaCha20::ChaCha20 ( const ChaCha20 & )
delete
函数调用图:

◆ ChaCha20() [4/5]

RandX::ChaCha20::ChaCha20 ( const std::uint8_t * key,
std::size_t keyLen,
const std::uint8_t * nonce,
std::size_t nonceLen,
std::uint32_t counter = 0 )
inline

构造方式 3:直接指定 key + nonce + counter(高级用法/测试复现)

参数
key密钥指针,须为 32 字节
keyLen密钥长度(字节),须为 32,否则抛出 std::invalid_argument
nonce随机数指针,须为 12 字节
nonceLen随机数长度(字节),须为 12,否则抛出 std::invalid_argument
counter32-bit block 计数器初值(默认 0;KAT 测试时显式传 1)
注解
此构造路径不调用 SecureRandomBytes,调用方须自行保证 key/nonce 的熵源

◆ ChaCha20() [5/5]

RandX::ChaCha20::ChaCha20 ( std::uint64_t seed)
inlineexplicitnodiscard

构造方式 2:以显式 64 位种子构造

参数
seed64 位种子值
注解
仅用于测试/复现,非密码学安全(种子空间仅 64-bit)

◆ DefaultEngine()

Xoshiro256StarStar & RandX::DefaultEngine ( )
inlinenodiscard
函数调用图:

◆ deserialize() [1/2]

template<class Derived, class ResultType, std::size_t N>
void RandX::detail::EngineBase< Derived, ResultType, N >::deserialize ( const state_type & s)
inlineconstexprnoexcept

◆ deserialize() [2/2]

void RandX::SplitMix64::deserialize ( state_type state)
inlineconstexprnoexcept

从状态恢复引擎

参数
stateserialize() 返回的状态
参见
serialize()

◆ discard() [1/3]

void RandX::ChaCha20::discard ( unsigned long long n)
inline

跳过 n 个输出

参数
n跳过次数

◆ discard() [2/3]

template<class Derived, class ResultType, std::size_t N>
void RandX::detail::EngineBase< Derived, ResultType, N >::discard ( unsigned long long z)
inlineconstexprnoexcept

◆ discard() [3/3]

void RandX::SplitMix64::discard ( unsigned long long n)
inlineconstexprnoexcept

跳过 n 个输出

参数
n跳过次数
函数调用图:

◆ DoubleFromBits()

template<std::same_as< std::uint64_t > Uint64>
double RandX::DoubleFromBits ( Uint64 i)
inlinenodiscardconstexprnoexcept

◆ EngineBase() [1/4]

template<class Derived, class ResultType, std::size_t N>
RandX::detail::EngineBase< Derived, ResultType, N >::EngineBase ( )
protecteddefault

◆ EngineBase() [2/4]

template<class Derived, class ResultType, std::size_t N>
RandX::detail::EngineBase< Derived, ResultType, N >::EngineBase ( const state_type & state)
inlineexplicitconstexprprotectednoexcept

◆ EngineBase() [3/4]

template<class Derived, class ResultType, std::size_t N>
template<class SeedSeq>
requires (!std::same_as<std::remove_cvref_t<SeedSeq>, state_type> && !std::same_as<std::remove_cvref_t<SeedSeq>, Derived>)
RandX::detail::EngineBase< Derived, ResultType, N >::EngineBase ( SeedSeq & seq)
inlineexplicitconstexprprotected

◆ EngineBase() [4/4]

template<class Derived, class ResultType, std::size_t N>
RandX::detail::EngineBase< Derived, ResultType, N >::EngineBase ( std::uint64_t seed)
inlineexplicitconstexprprotectednoexcept

◆ FloatFromBits()

template<std::same_as< std::uint32_t > Uint32>
float RandX::FloatFromBits ( Uint32 i)
inlinenodiscardconstexprnoexcept

◆ generateSeedSequence()

template<std::size_t N>
std::array< std::uint64_t, N > RandX::SplitMix64::generateSeedSequence ( )
inlinenodiscardconstexprnoexcept

生成 N 个高质量的 64 位种子序列

模板参数
N生成的种子数量
返回
包含 N 个 uint64 的数组,可用于播种其他引擎
函数调用图:

◆ IsAllZero() [1/2]

template<std::size_t N>
bool RandX::detail::IsAllZero ( const std::array< std::uint32_t, N > & state)
inlinenodiscardconstexprnoexcept

◆ IsAllZero() [2/2]

template<std::size_t N>
bool RandX::detail::IsAllZero ( const std::array< std::uint64_t, N > & state)
inlinenodiscardconstexprnoexcept

◆ IsValidState()

template<typename State>
bool RandX::detail::IsValidState ( const State & state)
inlinenodiscardconstexprnoexcept
函数调用图:

◆ jump() [1/3]

void RandX::Xoroshiro128StarStar::jump ( )
inlineconstexprnoexcept

前进 2^64 步,用于创建并行子序列

注解
等价于调用 2^64 次 operator()
参见
longJump(), MakeStreamEngine()
函数调用图:

◆ jump() [2/3]

void RandX::Xoshiro128StarStar::jump ( )
inlineconstexprnoexcept

前进 2^64 步,用于创建并行子序列

注解
等价于调用 2^64 次 operator()
参见
longJump(), MakeStreamEngine()
函数调用图:

◆ jump() [3/3]

void RandX::Xoshiro256StarStar::jump ( )
inlineconstexprnoexcept

前进 2^128 步,用于创建并行子序列

注解
等价于调用 2^128 次 operator()
参见
longJump(), MakeStreamEngine()
函数调用图:

◆ jumpPoly()

template<class Derived, class ResultType, std::size_t N>
template<std::size_t K>
void RandX::detail::EngineBase< Derived, ResultType, N >::jumpPoly ( const ResultType(&) poly[K])
inlineconstexprprotectednoexcept

◆ longJump() [1/3]

void RandX::Xoroshiro128StarStar::longJump ( )
inlineconstexprnoexcept

前进 2^96 步,用于创建更稀疏的并行子序列

注解
等价于调用 2^96 次 operator()
参见
jump(), MakeStreamEngine()
函数调用图:

◆ longJump() [2/3]

void RandX::Xoshiro128StarStar::longJump ( )
inlineconstexprnoexcept

前进 2^96 步,用于创建更稀疏的并行子序列

注解
等价于调用 2^96 次 operator()
参见
jump(), MakeStreamEngine()
函数调用图:

◆ longJump() [3/3]

void RandX::Xoshiro256StarStar::longJump ( )
inlineconstexprnoexcept

前进 2^192 步,用于创建更稀疏的并行子序列

注解
等价于调用 2^192 次 operator()
参见
jump(), MakeStreamEngine()
函数调用图:

◆ max() [1/3]

constexpr result_type RandX::ChaCha20::max ( )
inlinestaticnodiscardconstexprnoexcept

输出范围上界

返回
2^64 - 1

◆ max() [2/3]

template<class Derived, class ResultType, std::size_t N>
constexpr result_type RandX::detail::EngineBase< Derived, ResultType, N >::max ( )
inlinestaticnodiscardconstexprnoexcept

◆ max() [3/3]

SplitMix64::result_type RandX::SplitMix64::max ( )
inlinestaticnodiscardconstexprnoexcept

输出范围上界

返回
2^64 - 1

◆ min() [1/3]

constexpr result_type RandX::ChaCha20::min ( )
inlinestaticnodiscardconstexprnoexcept

输出范围下界

返回
0
函数调用图:

◆ min() [2/3]

template<class Derived, class ResultType, std::size_t N>
constexpr result_type RandX::detail::EngineBase< Derived, ResultType, N >::min ( )
inlinestaticnodiscardconstexprnoexcept

◆ min() [3/3]

SplitMix64::result_type RandX::SplitMix64::min ( )
inlinestaticnodiscardconstexprnoexcept

输出范围下界

返回
0

◆ operator()() [1/8]

ChaCha20::result_type RandX::ChaCha20::operator() ( )
inline

生成下一个 64 位随机数

返回
[min(), max()] 区间内的密码学安全伪随机数

◆ operator()() [2/8]

RomuDuoJr::result_type RandX::RomuDuoJr::operator() ( )
inlineconstexprnoexcept

生成下一个 64 位随机数

返回
[min(), max()] 区间内的伪随机数
函数调用图:

◆ operator()() [3/8]

SFC64::result_type RandX::SFC64::operator() ( )
inlineconstexprnoexcept

生成下一个 64 位随机数

返回
[min(), max()] 区间内的伪随机数
函数调用图:

◆ operator()() [4/8]

SplitMix64::result_type RandX::SplitMix64::operator() ( )
inlineconstexprnoexcept

生成下一个 64 位随机数

返回
[min(), max()] 区间内的伪随机数

◆ operator()() [5/8]

Xoroshiro128StarStar::result_type RandX::Xoroshiro128StarStar::operator() ( )
inlineconstexprnoexcept

生成下一个 64 位随机数

返回
[min(), max()] 区间内的伪随机数
函数调用图:

◆ operator()() [6/8]

Xoroshiro64StarStar::result_type RandX::Xoroshiro64StarStar::operator() ( )
inlineconstexprnoexcept

生成下一个 32 位随机数

返回
[min(), max()] 区间内的伪随机数
函数调用图:

◆ operator()() [7/8]

Xoshiro128StarStar::result_type RandX::Xoshiro128StarStar::operator() ( )
inlineconstexprnoexcept

生成下一个 32 位随机数

返回
[min(), max()] 区间内的伪随机数
函数调用图:

◆ operator()() [8/8]

Xoshiro256StarStar::result_type RandX::Xoshiro256StarStar::operator() ( )
inlineconstexprnoexcept

生成下一个 64 位随机数

返回
[min(), max()] 区间内的伪随机数
函数调用图:

◆ operator<<()

template<class CharT, class Traits, detail::SerializableEngine Engine>
std::basic_ostream< CharT, Traits > & RandX::operator<< ( std::basic_ostream< CharT, Traits > & os,
const Engine & engine )

◆ operator=() [1/2]

ChaCha20 & RandX::ChaCha20::operator= ( ChaCha20 && other)
inlinenoexcept
函数调用图:

◆ operator=() [2/2]

ChaCha20 & RandX::ChaCha20::operator= ( const ChaCha20 & )
delete
函数调用图:

◆ operator>>()

template<class CharT, class Traits, detail::SerializableEngine Engine>
std::basic_istream< CharT, Traits > & RandX::operator>> ( std::basic_istream< CharT, Traits > & is,
Engine & engine )
函数调用图:

◆ RandomSeed()

std::uint64_t RandX::RandomSeed ( )
inlinenodiscard

生成非确定性的 64 位种子

返回
优先硬件 RNG 的种子值
注解
优先级链:RDRAND (x86_64) → detail::GetOsEntropyBytes → std::random_device → 时间戳回退
函数调用图:

◆ reseed()

void RandX::ChaCha20::reseed ( )
inline

从 OS 熵重新播种

注解
手动触发,重置 counter 与字节缓存
函数调用图:

◆ ResetThreadLocalEngine()

void RandX::ResetThreadLocalEngine ( )
inline

重新播种当前线程的默认引擎(用于 POSIX fork() 产生子进程后重置引擎状态)

函数调用图:

◆ RomuDuoJr() [1/4]

RandX::RomuDuoJr::RomuDuoJr ( )
inlineconstexprnoexcept

< 状态类型(2×uint64)

默认构造(使用 DefaultSeed)

◆ RomuDuoJr() [2/4]

template<class SeedSeq>
requires (!std::same_as<std::remove_cvref_t<SeedSeq>, RomuDuoJr>)
RandX::RomuDuoJr::RomuDuoJr ( SeedSeq & seq)
inlineexplicitnodiscardconstexpr

从 std::seed_seq 播种

参数
seq种子序列对象

◆ RomuDuoJr() [3/4]

RandX::RomuDuoJr::RomuDuoJr ( state_type state)
inlineexplicitnodiscardconstexprnoexcept

从状态数组直接构造

参数
stateserialize() 返回的状态

◆ RomuDuoJr() [4/4]

RandX::RomuDuoJr::RomuDuoJr ( std::uint64_t seed)
inlineexplicitnodiscardconstexprnoexcept

以指定种子构造引擎

参数
seed64 位种子值

◆ RotL() [1/2]

std::uint32_t RandX::detail::RotL ( const std::uint32_t x,
const int s )
inlinenodiscardconstexprnoexcept

◆ RotL() [2/2]

std::uint64_t RandX::detail::RotL ( const std::uint64_t x,
const int s )
inlinenodiscardconstexprnoexcept

◆ serialize() [1/2]

template<class Derived, class ResultType, std::size_t N>
state_type RandX::detail::EngineBase< Derived, ResultType, N >::serialize ( ) const
inlinenodiscardconstexprnoexcept

◆ serialize() [2/2]

SplitMix64::state_type RandX::SplitMix64::serialize ( ) const
inlinenodiscardconstexprnoexcept

序列化引擎状态

返回
当前状态值
参见
deserialize()

◆ SFC64() [1/4]

RandX::SFC64::SFC64 ( )
inlineconstexprnoexcept

< 状态类型(4×uint64)

默认构造(使用 DefaultSeed)

函数调用图:

◆ SFC64() [2/4]

template<class SeedSeq>
requires (!std::same_as<std::remove_cvref_t<SeedSeq>, SFC64>)
RandX::SFC64::SFC64 ( SeedSeq & seq)
inlineexplicitnodiscardconstexpr

从 std::seed_seq 播种(填充 3 状态字 + counter=1 + 12 轮预热)

参数
seq种子序列对象
函数调用图:

◆ SFC64() [3/4]

RandX::SFC64::SFC64 ( state_type state)
inlineexplicitnodiscardconstexprnoexcept

从状态数组直接构造

参数
stateserialize() 返回的状态

◆ SFC64() [4/4]

RandX::SFC64::SFC64 ( std::uint64_t seed)
inlineexplicitnodiscardconstexprnoexcept

以指定种子构造引擎(SplitMix64 填充 3 状态字 + counter=1 + 12 轮预热)

参数
seed64 位种子值
函数调用图:

◆ SplitMix64() [1/2]

template<class SeedSeq>
requires (!std::same_as<std::remove_cvref_t<SeedSeq>, SplitMix64>)
RandX::SplitMix64::SplitMix64 ( SeedSeq & seq)
inlineexplicitnodiscardconstexpr

从 std::seed_seq 播种

参数
seq种子序列对象
函数调用图:

◆ SplitMix64() [2/2]

RandX::SplitMix64::SplitMix64 ( state_type state = DefaultSeed)
inlineexplicitnodiscardconstexprnoexcept

以指定状态构造引擎

参数
state64 位初始状态值

◆ Xoroshiro128StarStar() [1/4]

RandX::Xoroshiro128StarStar::Xoroshiro128StarStar ( )
inlineconstexprnoexcept

< 状态类型(2×uint64)

默认构造(使用 DefaultSeed)

◆ Xoroshiro128StarStar() [2/4]

template<class SeedSeq>
requires (!std::same_as<std::remove_cvref_t<SeedSeq>, Xoroshiro128StarStar>)
RandX::Xoroshiro128StarStar::Xoroshiro128StarStar ( SeedSeq & seq)
inlineexplicitnodiscardconstexpr

从 std::seed_seq 播种

参数
seq种子序列对象

◆ Xoroshiro128StarStar() [3/4]

RandX::Xoroshiro128StarStar::Xoroshiro128StarStar ( state_type state)
inlineexplicitnodiscardconstexprnoexcept

从状态数组直接构造

参数
stateserialize() 返回的状态

◆ Xoroshiro128StarStar() [4/4]

RandX::Xoroshiro128StarStar::Xoroshiro128StarStar ( std::uint64_t seed)
inlineexplicitnodiscardconstexprnoexcept

以指定种子构造引擎

参数
seed64 位种子值

◆ Xoroshiro64StarStar() [1/4]

RandX::Xoroshiro64StarStar::Xoroshiro64StarStar ( )
inlineconstexprnoexcept

< 状态类型(2×uint32)

默认构造(使用 DefaultSeed)

◆ Xoroshiro64StarStar() [2/4]

template<class SeedSeq>
requires (!std::same_as<std::remove_cvref_t<SeedSeq>, Xoroshiro64StarStar>)
RandX::Xoroshiro64StarStar::Xoroshiro64StarStar ( SeedSeq & seq)
inlineexplicitnodiscardconstexpr

从 std::seed_seq 播种

参数
seq种子序列对象

◆ Xoroshiro64StarStar() [3/4]

RandX::Xoroshiro64StarStar::Xoroshiro64StarStar ( state_type state)
inlineexplicitnodiscardconstexprnoexcept

从状态数组直接构造

参数
stateserialize() 返回的状态

◆ Xoroshiro64StarStar() [4/4]

RandX::Xoroshiro64StarStar::Xoroshiro64StarStar ( std::uint64_t seed)
inlineexplicitnodiscardconstexprnoexcept

以指定种子构造引擎

参数
seed64 位种子值

◆ Xoshiro128StarStar() [1/4]

RandX::Xoshiro128StarStar::Xoshiro128StarStar ( )
inlineconstexprnoexcept

< 状态类型(4×uint32)

默认构造(使用 DefaultSeed)

◆ Xoshiro128StarStar() [2/4]

template<class SeedSeq>
requires (!std::same_as<std::remove_cvref_t<SeedSeq>, Xoshiro128StarStar>)
RandX::Xoshiro128StarStar::Xoshiro128StarStar ( SeedSeq & seq)
inlineexplicitnodiscardconstexpr

从 std::seed_seq 播种

参数
seq种子序列对象

◆ Xoshiro128StarStar() [3/4]

RandX::Xoshiro128StarStar::Xoshiro128StarStar ( state_type state)
inlineexplicitnodiscardconstexprnoexcept

从状态数组直接构造

参数
stateserialize() 返回的状态

◆ Xoshiro128StarStar() [4/4]

RandX::Xoshiro128StarStar::Xoshiro128StarStar ( std::uint64_t seed)
inlineexplicitnodiscardconstexprnoexcept

以指定种子构造引擎

参数
seed64 位种子值

◆ Xoshiro256StarStar() [1/4]

RandX::Xoshiro256StarStar::Xoshiro256StarStar ( )
inlineconstexprnoexcept

< 状态类型(4×uint64)

默认构造(使用 DefaultSeed)

◆ Xoshiro256StarStar() [2/4]

template<class SeedSeq>
requires (!std::same_as<std::remove_cvref_t<SeedSeq>, Xoshiro256StarStar>)
RandX::Xoshiro256StarStar::Xoshiro256StarStar ( SeedSeq & seq)
inlineexplicitnodiscardconstexpr

从 std::seed_seq 播种

参数
seq种子序列对象

◆ Xoshiro256StarStar() [3/4]

RandX::Xoshiro256StarStar::Xoshiro256StarStar ( state_type state)
inlineexplicitnodiscardconstexprnoexcept

从状态数组直接构造

参数
stateserialize() 返回的状态

◆ Xoshiro256StarStar() [4/4]

RandX::Xoshiro256StarStar::Xoshiro256StarStar ( std::uint64_t seed)
inlineexplicitnodiscardconstexprnoexcept

以指定种子构造引擎

参数
seed64 位种子值

◆ ~ChaCha20()

RandX::ChaCha20::~ChaCha20 ( )
inlinenoexcept
函数调用图:

变量说明

◆ Bits

template<class Derived, class ResultType, std::size_t N>
constexpr int RandX::detail::EngineBase< Derived, ResultType, N >::Bits = static_cast<int>(sizeof(ResultType) * 8)
staticconstexprprotected

◆ s_

template<class Derived, class ResultType, std::size_t N>
state_type RandX::detail::EngineBase< Derived, ResultType, N >::s_ {}
protected

友元

◆ operator<=> [1/2]

template<class Derived, class ResultType, std::size_t N>
auto operator<=> ( const EngineBase< Derived, ResultType, N > & ,
const EngineBase< Derived, ResultType, N > &  )
friend

◆ operator<=> [2/2]

auto operator<=> ( const SplitMix64 & ,
const SplitMix64 &  )
friend