D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2951 - std.random.dice() should be templated on proportions.
Summary: std.random.dice() should be templated on proportions.
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86 Windows
: P2 enhancement
Assignee: Andrei Alexandrescu
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-07 10:50 UTC by David Simcha
Modified: 2015-06-09 01:26 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description David Simcha 2009-05-07 10:50:06 UTC
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.
Comment 1 David Simcha 2010-08-16 20:39:00 UTC
Fixed SVN.