Interesting bug with std.random.uniform and dchar

Joseph Rushton Wakeling via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jun 8 02:17:41 PDT 2014


On 08/06/14 11:02, monarch_dodra via Digitalmars-d-learn wrote:
> Why would we ban uniform!T from accepting dchar? I see no reason for that.
>
> Let's just fix the bug by tweaking the internal check.

Yea, I came to the same conclusion while working on it. :-)

The solution I have is (i) in uniform!"[]" check that !is(ResultType == dchar) 
before checking the condition for calling uniform!ResultType, and (ii) inside 
uniform!T, place

     static if (is(T == dchar))
     {
         return uniform!"[]"(T.min, T.max, rng);
     }



More information about the Digitalmars-d-learn mailing list