April 24, 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@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@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: -------
April 24, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5883


David Simcha <dsimcha@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dsimcha@yahoo.com
         Resolution|                            |FIXED


--- Comment #1 from David Simcha <dsimcha@yahoo.com> 2011-04-24 16:11:30 PDT ---
This was fixed a while back in Git and will be in the next release.  (Thanks,
Andrei.)

https://github.com/D-Programming-Language/phobos/commit/1083bd4e7b4ef0475084d7eab2e67c65e511c3d4

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