|
NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
|
梅森旋转随机数生成器 更多...
#include <random.hpp>
Public 类型 | |
| using | seed_type = uint32_t |
| 种子类型 | |
Public 成员函数 | |
| random_mt () noexcept | |
| 默认构造函数 默认使用当前时间戳值作为种子。 | |
| random_mt (const seed_type seed) noexcept | |
| 带种子构造函数 | |
| void | set_seed (seed_type seed) noexcept |
| 设置随机数种子 | |
| template<typename T> | |
| T | next_int (T max) noexcept |
| 生成 [0, max) 范围内的随机整数 | |
| template<typename T> | |
| T | next_int (T min, T max) noexcept |
| 生成[min, max)范围内的随机整数 | |
| template<typename T> | |
| T | next_int () noexcept |
| 生成完整范围的随机整数 | |
| uint64_t | next_uint64 (uint64_t max) noexcept |
| 生成 [0, max) 范围内的随机 64 位整数 | |
| uint64_t | next_uint64 () noexcept |
| 生成完整范围的随机 64 位整数 | |
| template<typename T> | |
| T | next_float () noexcept |
| 生成 [0, 1) 范围内的随机浮点数 | |
| template<typename T> | |
| T | next_float (T min, T max) noexcept |
| 生成 [min, max) 范围内的随机浮点数 | |
| template<typename T> | |
| T | next_float (T max) noexcept |
| 生成 [0, max) 范围内的随机浮点数 | |
梅森旋转随机数生成器
使用梅森旋转算法 Mersenne Twister 生成高质量伪随机数, 周期长(2^19937-1), 随机性良好,但生成速度较慢。
在文件 random.hpp 第 219 行定义.
|
inlineexplicitnoexcept |
|
inlinenoexcept |
生成 [0, 1) 范围内的随机浮点数
| T | 浮点类型 |
在文件 random.hpp 第 342 行定义.
引用了 generate(), is_floating_point_v , 以及 numeric_traits< T, Dummy >::max().
被这些函数引用 next_float() , 以及 next_float().
|
inlinenoexcept |
生成 [0, max) 范围内的随机浮点数
| T | 浮点类型 |
| max | 上限(不包含) |
在文件 random.hpp 第 371 行定义.
引用了 max() , 以及 next_float().
|
inlinenoexcept |
生成 [min, max) 范围内的随机浮点数
| T | 浮点类型 |
| min | 下限(包含) |
| max | 上限(不包含) |
在文件 random.hpp 第 357 行定义.
引用了 max(), min() , 以及 next_float().
|
inlinenoexcept |
|
inlinenoexcept |
生成 [0, max) 范围内的随机整数
| T | 整形类型 |
| max | 上限(不包含) |
在文件 random.hpp 第 272 行定义.
引用了 is_integral_v , 以及 max().
被这些函数引用 next_int().
|
inlinenoexcept |
生成[min, max)范围内的随机整数
| T | 整形类型 |
| min | 下限(包含) |
| max | 上限(不包含) |
在文件 random.hpp 第 295 行定义.
引用了 max(), min() , 以及 next_int().
|
inlinenoexcept |
生成 [0, max) 范围内的随机 64 位整数
| max | 上限(不包含) |
在文件 random.hpp 第 318 行定义.
引用了 max().
|
noexcept |