[Issue 18332] New: rt.util.random.Rand48 remove unnecessary assert and mask

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 30 03:45:55 UTC 2018


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

          Issue ID: 18332
           Summary: rt.util.random.Rand48 remove unnecessary assert and
                    mask
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: trivial
          Priority: P1
         Component: druntime
          Assignee: nobody at puremagic.com
          Reporter: n8sh.secondary at hotmail.com

seed(uint): There is no need for seedval to be non-zero. The assertion should
be removed.

popFront(): rng_state is private and is only exposed through front() which
never exposes the high 16 bits of rng_state. popFront() advances rng_state
through addition and multiplication so the high 16 bits of the current
rng_state never affect the low 48 bits of the next rng_state. So masking
rng_state to clear the high 16 bits is unnecessary (unless comparing Rand48
structs for equality or computing bitwise hashcodes of their contents, which
doesn't appear to happen anywhere).

--


More information about the Digitalmars-d-bugs mailing list