hi,
the question is fairly simple: is there a clean way to get a random item from an enum?
that’s all :
gues not afaik theres:
there is sticking it in an collection and shuflle() it.
http://java.sun.com/j2se/1.5.0/docs/guide/language/enums.html
or you could do something with values() calculate a random integer between 0 and values().length
You just want a random member of an enum? try thhis
enum Foo { … }
Foo[] fooValues = Foo.values();
return fooValues[(int)(Math.random()*fooValues.length)];
ok, thanks