generating random enums
Posted
by null_radix
on Stack Overflow
See other posts from Stack Overflow
or by null_radix
Published on 2010-06-08T15:55:51Z
Indexed on
2010/06/08
16:02 UTC
Read the original article
Hit count: 137
How do I randomly select a value for an enum type in C++? I would like to do something like this.
enum my_type(A,B,C,D,E,F,G,h,J,V);
my_type test(rand() % 10);
But this is illegal... there is not an implicit conversion from int to an enum type.
© Stack Overflow or respective owner