[Issue 2951] New: std.random.dice() should be templated on proportions.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 7 08:49:57 PDT 2009


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

           Summary: std.random.dice() should be templated on proportions.
           Product: D
           Version: 2.029
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: dsimcha at yahoo.com


The current signature for std.random.dice() is:

size_t dice(R)(ref R rnd, double[] proportions...); 

Correct me if I'm wrong, but I think it would be trivial to change it to
something like:

size_t dice(T)(ref R rnd, T[] proportions...); 

This way, if you're passing in a pre-existing array instead of treating dice as
a variadic function, you won't have to convert it.


-- 



More information about the Digitalmars-d-bugs mailing list