Java tutorial
import java.util.Random; enum Season { WINTER, SPRING, SUMMER, FALL } class RandomEnum<E extends Enum<Season>> { Random RND = new Random(); E[] values; public RandomEnum(Class<E> token) { values = token.getEnumConstants(); } public E random() { return values[RND.nextInt(values.length)]; } } public class Main { public static void main(String[] args) { RandomEnum<Season> r = new RandomEnum<Season>(Season.class); System.out.println(r.random()); } }