Skip to content

Commit

Permalink
Merge pull request #1932 from AndrejMitrovic/UniformDocs
Browse files Browse the repository at this point in the history
Add uniform example for enums.
  • Loading branch information
monarchdodra committed Feb 13, 2014
2 parents 2b71a0b + 7491437 commit b88dd4d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions std/random.d
Expand Up @@ -1530,6 +1530,13 @@ if (is(E == enum))
return uniform!E(rndGen);
}

///
unittest
{
enum Fruit { apple, mango, pear }
auto randFruit = uniform!Fruit();
}

unittest
{
enum Fruit { Apple = 12, Mango = 29, Pear = 72 }
Expand Down

0 comments on commit b88dd4d

Please sign in to comment.