|
ngl_server 1.0
基于 Actor 模型的 C++ 服务器框架
|
随机数生成的内部实现命名空间 More...
Functions | |
| uint64_t | splitmix64 (uint64_t ax) |
| SplitMix64哈希函数 | |
| std::once_flag & | seed_once () |
| 获取种子初始化的once_flag | |
| std::atomic< uint64_t > & | seed_ctr () |
| 获取原子种子计数器 | |
| uint64_t | make_seed () |
| 生成初始随机种子 | |
| uint64_t | next_seed () |
| 生成线程唯一的种子值 | |
随机数生成的内部实现命名空间
使用SplitMix64算法生成高质量随机数种子 结合线程ID确保多线程环境下的唯一性
| uint64_t ngl::tools::rand_detail::make_seed | ( | ) |
生成初始随机种子
组合random_device、时间戳和SplitMix64算法
| uint64_t ngl::tools::rand_detail::next_seed | ( | ) |
生成线程唯一的种子值
首次调用时初始化全局种子,之后每次调用递增 结合线程ID确保不同线程获得不同种子
| std::atomic< uint64_t > & ngl::tools::rand_detail::seed_ctr | ( | ) |
获取原子种子计数器
用于生成线程唯一的种子值
| std::once_flag & ngl::tools::rand_detail::seed_once | ( | ) |
获取种子初始化的once_flag
确保种子只初始化一次
| uint64_t ngl::tools::rand_detail::splitmix64 | ( | uint64_t | ax | ) |
SplitMix64哈希函数
| ax | 输入值 |
用于将种子值混合,提高随机性