std.random.uniform for enums

Anton vizardx at gmail.com
Wed Feb 12 18:02:35 PST 2014


I'm confused about how to use random.uniform to select a member 
of an enum.

Say I have an enum like

     enum Animals
     {
       cat  = 0,
       dog = 1,
       chimpanzee = 2
     }

I want to select a random animal. So far I've been trying to do 
uniform(Animals), but every time I try to compile that, I get a 
"does not match any function template declaration" error.

Am I misunderstanding how this function is meant to be used?


More information about the Digitalmars-d-learn mailing list