www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21609] New: LinearCongruentialEngine fails for m = 0

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 puremagic.com
          Reporter: elpenguino+D 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);
```

--
Feb 03 2021