|
| template<std::floating_point T = double> |
| T | RandX::RandNormal (T mean=T{0}, T stddev=T{1}) |
| | 生成正态分布随机数
|
| template<class Engine, std::floating_point T = double> |
| T | RandX::RandNormal (Engine &engine, T mean=T{0}, T stddev=T{1}) |
| | 生成正态分布随机数(指定引擎重载)
|
| template<std::ranges::random_access_range Container> |
| void | RandX::RandShuffle (Container &&c) |
| | 随机打乱容器
|
template<class It, class T>
requires detail::RandFillable<It, T> && std::integral<T> |
| void | RandX::RandFill (It first, It last, T min, T max) |
| | 用 [min, max] 范围的随机整数填充迭代器区间
|
template<class It, class T, class Engine>
requires detail::RandFillable<It, T> && std::integral<T> |
| void | RandX::RandFill (Engine &engine, It first, It last, T min, T max) |
| | 用 [min, max] 范围的随机整数填充迭代器区间(指定引擎重载)
|
| template<std::integral T = int> |
| std::vector< T > | RandX::RandVector (T min, T max, std::size_t n) |
| | 生成含 n 个随机整数的 vector
|
| template<std::integral T = int, class Engine> |
| std::vector< T > | RandX::RandVector (Engine &engine, T min, T max, std::size_t n) |
| | 生成含 n 个随机整数的 vector(指定引擎重载)
|
| template<class WeightContainer> |
| WeightContainer::size_type | RandX::RandWeighted (const WeightContainer &weights) |
| | 按权重随机选取索引
|
| template<class Engine, class WeightContainer> |
| WeightContainer::size_type | RandX::RandWeighted (Engine &engine, const WeightContainer &weights) |
| | 按权重随机选取索引(指定引擎重载)
|
| template<class IntType> |
| IntType | RandX::RandWeighted (std::discrete_distribution< IntType > &dist) |
| | 按预构建权重分布随机选取索引(支持高频抽取复用,O(1) 复杂度)
|
| template<class Engine, class IntType> |
| IntType | RandX::RandWeighted (Engine &engine, std::discrete_distribution< IntType > &dist) |
| | 按预构建权重分布随机选取索引(指定引擎,支持高频抽取复用,O(1) 复杂度)
|
| template<std::integral T, class Engine> |
| T | RandX::RandInt (Engine &engine, T min, T max) |
| | 生成 [min, max] 范围内的随机整数(指定引擎重载)
|
| template<std::floating_point T, class Engine> |
| T | RandX::RandReal (Engine &engine, T min=T{0}, T max=T{1}) |
| | 生成 [min, max) 范围内的随机浮点数(指定引擎重载)
|
| char | RandX::RandChar (CharSet cs) |
| | 从预设字符集随机取一个字符
|
| template<class Engine> |
| char | RandX::RandChar (Engine &engine, CharSet cs) |
| | 从预设字符集随机取一个字符(指定引擎重载)
|
| template<std::ranges::random_access_range Container> |
| auto | RandX::RandSample (const Container &c, typename Container::size_type n) |
| | 无放回抽样:从容器中随机抽取 n 个元素(Fisher-Yates 前 n 步)
|
| template<std::random_access_iterator It> |
| std::vector< std::iter_value_t< It > > | RandX::RandSample (It first, It last, std::iter_difference_t< It > n) |
| | 无放回抽样(随机访问迭代器版,hash-set / 索引数组双分支)
|
| template<std::random_access_iterator It, class Engine> |
| std::vector< std::iter_value_t< It > > | RandX::RandSample (Engine &engine, It first, It last, std::iter_difference_t< It > n) |
| | 无放回抽样(指定引擎,随机访问迭代器版)
|
| std::vector< std::size_t > | RandX::RandPermutation (std::size_t n) |
| | 生成 [0, n) 的随机排列
|