c++ enum rand

C++
enum Color {Red, Green, Blue};
Color color = Color(rand()%3);
Source

Also in C++: