Answers for "how to get a random item from an enum java"

1

java choose random enum

return yourEnum.values()[new Random().nextInt(yourEnum.values().length)];
Posted by: Guest on May-12-2021
-1

get random number from enum in java

return Letter.values()[new Random().nextInt(Letter.values().length)];
Posted by: Guest on May-03-2020

Code answers related to "how to get a random item from an enum java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language