std.random.uniform for enums
Adam D. Ruppe
destructionator at gmail.com
Wed Feb 12 18:58:59 PST 2014
On Thursday, 13 February 2014 at 02:52:44 UTC, Anton wrote:
> I guess I'm mostly confused because the description for one of
> the templates of std.random.uniform says "Returns a uniformly
> selected member of enum E.
Oooh, I didn't know it had one of those, the documentation can be
so hard to read sometimes.
Try this then:
auto randomAnimal = uniform!Animals();
The enum E there is a compile time argument, so you need the ! in
there to pass them. (uniform(Animal) would be trying to send it
as a run time argument which doesn't work for types)
More information about the Digitalmars-d-learn
mailing list