We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dicescript/roll_func.go
Lines 23 to 41 in 28fab8c
在 39 行对生成的随机数直接使用了取模运算. 由于生成的随机数是在非负 int32 上均匀的, 当 dicePoints 不是 2 的幂时, 导致较小余数出现的概率将比较大余数大.
dicePoints
如何验证问题存在: 统计 d1431000000 的分布. 由于这个数足够大, 可以使小出目的概率达到大出目的 2 倍.
The text was updated successfully, but these errors were encountered:
大概是修复了,经过了不严谨的测试: 20000d1431000000 = 14336068183245 20000d1431000000 = 14348112861946 20000d1431000000 = 14250829103396
(1431000000 / 2 + 1) *20000 ____________________ = 14310000020000
https://github.com/sealdice/dicescript/blob/main/roll_func.go#L44-L62
Sorry, something went wrong.
No branches or pull requests
dicescript/roll_func.go
Lines 23 to 41 in 28fab8c
在 39 行对生成的随机数直接使用了取模运算. 由于生成的随机数是在非负 int32 上均匀的, 当
dicePoints
不是 2 的幂时, 导致较小余数出现的概率将比较大余数大.如何验证问题存在: 统计 d1431000000 的分布. 由于这个数足够大, 可以使小出目的概率达到大出目的 2 倍.
The text was updated successfully, but these errors were encountered: