std.random.uniform for enums

Jakob Ovrum jakobovrum at gmail.com
Wed Feb 12 19:04:05 PST 2014


On Thursday, 13 February 2014 at 02:30:47 UTC, Frustrated wrote:
> Could you not simply select one at random by "name"? Even though
> the values of the enum may not be sequential the keys are.

Yeah, and there is apparently already an overload that does that.

Regardless, I wrote a version that has an optimized path for 
sequential enums:

https://gist.github.com/JakobOvrum/8968977


More information about the Digitalmars-d-learn mailing list