www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18332] New: rt.util.random.Rand48 remove unnecessary assert

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 puremagic.com
          Reporter: n8sh.secondary 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).

--
Jan 29 2018