|
RandX 1.4.3
基于 xoshiro/xoroshiro 算法族的纯头文件伪随机数生成器库
|
Xoshiro128** 伪随机数生成器,32 位输出,周期 2^128-1。 更多...
#include <RandX.hpp>
Public 类型 | |
| using | state_type = std::array<std::uint32_t, 4> |
| 状态类型(4×uint32) | |
| using | result_type = std::uint32_t |
| 输出类型 | |
| using | state_type = std::array<std::uint32_t, 4> |
| 状态类型(4×uint32) | |
| using | result_type = std::uint32_t |
| 输出类型 | |
Public 成员函数 | |
| constexpr | Xoshiro128StarStar (std::uint64_t seed=DefaultSeed) noexcept |
| 以指定种子构造引擎 | |
| template<class SeedSeq> requires (!std::same_as<std::remove_cvref_t<SeedSeq>, Xoshiro128StarStar>) | |
| constexpr | Xoshiro128StarStar (SeedSeq &seq) |
| 从 std::seed_seq 播种 | |
| constexpr | Xoshiro128StarStar (state_type state) noexcept |
| 从状态数组直接构造 | |
| constexpr result_type | operator() () noexcept |
| 生成下一个 32 位随机数 | |
| constexpr void | discard (unsigned long long n) noexcept |
| 跳过 n 个输出 | |
| constexpr void | jump () noexcept |
| 前进 2^64 步,用于创建并行子序列 | |
| constexpr void | longJump () noexcept |
| 前进 2^96 步,用于创建更稀疏的并行子序列 | |
| constexpr state_type | serialize () const noexcept |
| 序列化引擎状态 | |
| constexpr void | deserialize (state_type state) noexcept |
| 从状态恢复引擎 | |
| RANDX_NODISCARD_CXX20 constexpr | Xoshiro128StarStar (std::uint64_t seed=DefaultSeed) noexcept |
| 以指定种子构造引擎 | |
| template<class SeedSeq, std::enable_if_t<!std::is_same_v< std::decay_t< SeedSeq >, Xoshiro128StarStar > > * = nullptr> | |
| RANDX_NODISCARD_CXX20 constexpr | Xoshiro128StarStar (SeedSeq &seq) |
| 从 std::seed_seq 播种 | |
| RANDX_NODISCARD_CXX20 constexpr | Xoshiro128StarStar (state_type state) noexcept |
| 从状态数组直接构造 | |
| constexpr result_type | operator() () noexcept |
| 生成下一个 32 位随机数 | |
| constexpr void | discard (unsigned long long n) noexcept |
| 跳过 n 个输出 | |
| constexpr void | jump () noexcept |
| 前进 2^64 步,用于创建并行子序列 | |
| constexpr void | longJump () noexcept |
| 前进 2^96 步,用于创建更稀疏的并行子序列 | |
| constexpr state_type | serialize () const noexcept |
| 序列化引擎状态 | |
| constexpr void | deserialize (state_type state) noexcept |
| 从状态恢复引擎 | |
| template<class SeedSeq, std::enable_if_t<!std::is_same_v< std::decay_t< SeedSeq >, Xoshiro128StarStar > > *> | |
| constexpr | Xoshiro128StarStar (SeedSeq &seq) |
静态 Public 成员函数 | |
| static constexpr result_type | min () noexcept |
| 输出范围下界 | |
| static constexpr result_type | max () noexcept |
| 输出范围上界 | |
| static constexpr result_type | min () noexcept |
| 输出范围下界 | |
| static constexpr result_type | max () noexcept |
| 输出范围上界 | |
友元 | |
| auto | operator<=> (const Xoshiro128StarStar &, const Xoshiro128StarStar &)=default |
| bool | operator== (const Xoshiro128StarStar &lhs, const Xoshiro128StarStar &rhs) noexcept |
| bool | operator!= (const Xoshiro128StarStar &lhs, const Xoshiro128StarStar &rhs) noexcept |
Xoshiro128** 伪随机数生成器,32 位输出,周期 2^128-1。
状态 16 字节(4×uint32),32 位平台优先选择。 满足 std::uniform_random_bit_generator 概念。 原始实现:http://prng.di.unimi.it/xoshiro128starstar.c(版本 1.1)
| using RandX::Xoshiro128StarStar::result_type = std::uint32_t |
输出类型
| using RandX::Xoshiro128StarStar::state_type = std::array<std::uint32_t, 4> |
状态类型(4×uint32)
|
explicitconstexprnoexcept |
以指定种子构造引擎
| seed | 64 位种子值 |

|
explicitconstexpr |
从 std::seed_seq 播种
| seq | 种子序列对象 |
|
explicitconstexprnoexcept |
从状态数组直接构造
| state | serialize() 返回的状态 |
|
inlineconstexpr |

|
constexprnoexcept |
|
constexprnoexcept |
跳过 n 个输出
| n | 跳过次数 |

|
constexprnoexcept |
|
constexprnoexcept |
|
staticnodiscardconstexprnoexcept |
输出范围上界

|
staticnodiscardconstexprnoexcept |
输出范围下界

|
constexprnoexcept |
|
nodiscardconstexprnoexcept |
|
friend |
|
friend |