Bug 21609 – LinearCongruentialEngine fails for m = 0

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-02-04T04:25:20Z
Last change time
2021-02-05T01:37:30Z
Keywords
pull
Assigned to
No Owner
Creator
elpenguino+D

Comments

Comment #0 by elpenguino+D — 2021-02-04T04:25:20Z
std.random.LinearCongruentialEngine has an undocumented behaviour that allows for m = 0 when UIntType == uint, treating it as if it were 2^32. This special case is untested, and currently (as of DMD 2.095) produces a division by zero error. example: ``` alias MSVC = LinearCongruentialEngine!(uint, 214013, 2531011, 0); ```
Comment #1 by dlang-bot — 2021-02-04T04:27:53Z
@Herringway created dlang/phobos pull request #7786 "Fix issue 21609 - LinearCongruentialEngine fails for m = 0" fixing this issue: - Fix issue 21609 - LinearCongruentialEngine fails for m = 0 https://github.com/dlang/phobos/pull/7786
Comment #2 by dlang-bot — 2021-02-05T01:37:30Z
dlang/phobos pull request #7786 "Fix issue 21609 - LinearCongruentialEngine fails for m = 0" was merged into master: - 883fd4fad26e39f79084581ae401b9d9e37583e0 by Cameron Ross: Fix issue 21609 - LinearCongruentialEngine fails for m = 0 https://github.com/dlang/phobos/pull/7786