Skip to content

Commit

Permalink
Add uniform example for enums.
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrejMitrovic committed Feb 13, 2014
1 parent 4a7f1a9 commit 7491437
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions std/random.d
Original file line number Diff line number Diff line change
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 7491437

Please sign in to comment.