[Issue 12877] New: std.random.uniform cannot handle dchar variates

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Jun 8 09:40:43 PDT 2014


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

          Issue ID: 12877
           Summary: std.random.uniform cannot handle dchar variates
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: Phobos
          Assignee: nobody at puremagic.com
          Reporter: joseph.wakeling at webdrake.net

The uniform!T specialization, which returns a random variate covering the
entire bit range of an integral or character type T, will fail in the event
that T == dchar because dchar.max is significantly less than the largest number
that can be stored in dchar's 32 bits.

This in turn leads uniform!"[]"(dchar.min, dchar.max) to fail, because the
integral/character-type uniform() calls uniform!ReturnType in the event of a
closed interval with bounds [ReturnType.min, ReturnType.max].

See forum discussion for further details, including code that illustrates the
bug:
http://forum.dlang.org/thread/mailman.1906.1402217668.2907.digitalmars-d-learn@puremagic.com

--


More information about the Digitalmars-d-bugs mailing list