[Issue 21609] New: LinearCongruentialEngine fails for m = 0

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 4 04:25:20 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21609

          Issue ID: 21609
           Summary: LinearCongruentialEngine fails for m = 0
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: elpenguino+D at gmail.com

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);
```

--


More information about the Digitalmars-d-bugs mailing list