Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
|
|
lightbrotherV
left a comment
There was a problem hiding this comment.
fix random num same
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #74378 +/- ##
===========================================
Coverage ? 100.00%
===========================================
Files ? 1
Lines ? 3
Branches ? 0
===========================================
Hits ? 3
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
thanks |
|
hi, @lightbrotherV
|
PR Category
Execute Infrastructure
PR Types
Bug fixes
Description
GetRandomId() 函数每次调用时都会重新初始化随机数生成器 (std::random_device 和 std::mt19937_64),这会导致生成的随机数可能重复或不够随机。
std::random_device 被重复初始化:
每次调用函数时都新建 random_device 和 mt19937_64,可能导致种子相似(尤其在某些平台上 random_device 实现不够完善)。
伪随机数引擎未复用:
mt19937_64 的状态在每次函数调用时重置,失去了伪随机序列的长期统计特性