2015-11-03 12:00:44 -08:00

14 lines
357 B
Java

// com/mindviewinc/util/Enums.java
package com.mindviewinc.util;
import java.util.*;
public class Enums {
private static Random rand = new Random(47);
public static <T extends Enum<T>> T random(Class<T> ec) {
return random(ec.getEnumConstants());
}
public static <T> T random(T[] values) {
return values[rand.nextInt(values.length)];
}
}