First at the end of class, wrong initalization. - private UIntType _x = m ? a + c : (a + c) % m; + private UIntType _x = m ? (a + c) % m : (a + c); }; Second in this method we can assome that if m is 0, and type is int, it was really 2^^32 (0 in int). private static bool properLinearCongruentialParameters(ulong m, ulong a, ulong c) { + static if (is(UIntType == uint)) { + if (m == 0) m = (1uL << 32); + } // Bounds checking if (m == 0 || a == 0 || a >= m || c >= m) return false; // c and m are relatively prime This problems are orthogonal to the my proposed optimalisations in bug3738.
Makes sense. I operated the changes and will commit soon.
Fixed in DMD 2.040