[Issue 5883] New: std.random.dice() without rnd generator

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 24 14:29:17 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5883

           Summary: std.random.dice() without rnd generator
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-04-24 14:25:38 PDT ---
This is the online documentation of std.random.dice() (DMD 2.052) (note the
missing rnd generator agument):
http://www.digitalmars.com/d/2.0/phobos/std_random.html#dice

auto x = dice(0.5, 0.5);   // x is 0 or 1 in equal proportions
auto y = dice(50, 50);     // y is 0 or 1 in equal proportions
auto z = dice(70, 20, 10); // z is 0 70% of the time, 1 30% of the time,
                           // and 2 10% of the time


But this generates several compile bugs:

import std.random;
void main() {
    dice(0.5, 0.5);
}


While this compiles and runs:

import std.random;
void main() {
    auto rnd = Xorshift(1);
    dice(rnd, 0.5, 0.5);
}


This looks like a documentation bug, but I prefer to see it as an enhancement
request.


See also issue 5849

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list