www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12877] New: std.random.uniform cannot handle dchar variates


          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 puremagic.com
          Reporter: joseph.wakeling 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
http://forum.dlang.org/thread/mailman.1906.1402217668.2907.digitalmars-d-learn puremagic.com

Jun 08 2014