List of utility methods to do Random Enum
T | RandomEnum(Class Random Enum return RandomEnum(c, 0);
|
T | randomEnum(Class random Enum Random random = new Random(); int r = random.nextInt(c.getEnumConstants().length); return c.getEnumConstants()[r]; |
T | randomEnum(Class Gets a random enum value from an enum. return clazz.getEnumConstants()[RANDOM.nextInt(clazz.getEnumConstants().length)];
|
T | randomEnum(Class random Enum int x = new Random().nextInt(cls.getEnumConstants().length); T t = cls.getEnumConstants()[x]; return t.equals(exceptValue) ? randomEnum(cls, exceptValue) : t; |
Set | randomEnumSet(Class random Enum Set EnumSet<E> set = EnumSet.noneOf(enumType); for (E e : EnumSet.allOf(enumType)) { if (randomPositiveInt() % 2 == 1) { set.add(e); return set; |