www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18217] New: Don't repeatedly call unpredictableSeed to


          Issue ID: 18217
           Summary: Don't repeatedly call unpredictableSeed to initialize
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: n8sh.secondary hotmail.com

The offending code in std.random:
static if (isSeedable!(Random, typeof(map!((a) =>
    result.seed(map!((a) => unpredictableSeed)(repeat(0)));

Having this code in Phobos leads others to mistakenly copy it since
Phobos is generally a model of good D programming practices.
Calling unpredictableSeed just once would be faster and would give
a better result. See comment for an explanation:


Jan 09 2018