diff options
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcutils/EnumUtils.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/funcutils/EnumUtils.java | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcutils/EnumUtils.java b/BJC-Utils2/src/main/java/bjc/utils/funcutils/EnumUtils.java index 3374aa2..67fd5ec 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcutils/EnumUtils.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcutils/EnumUtils.java @@ -14,24 +14,6 @@ import bjc.utils.funcdata.IFunctionalList; */ public class EnumUtils { /** - * Get a random value from an enum - * - * @param <E> - * The type of the enum - * @param enumClass - * The class of the enum - * @param rnd - * The random source to use - * @return A random value from the specified enum - */ - public static <E extends Enum<E>> E getRandomValue(Class<E> enumClass, - Random rnd) { - E[] enumValues = enumClass.getEnumConstants(); - - return new FunctionalList<>(enumValues).randItem(rnd::nextInt); - } - - /** * Do an action for a random number of enum values * * @param <E> @@ -61,4 +43,22 @@ public class EnumUtils { valueList.forEach(action); } + + /** + * Get a random value from an enum + * + * @param <E> + * The type of the enum + * @param enumClass + * The class of the enum + * @param rnd + * The random source to use + * @return A random value from the specified enum + */ + public static <E extends Enum<E>> E getRandomValue(Class<E> enumClass, + Random rnd) { + E[] enumValues = enumClass.getEnumConstants(); + + return new FunctionalList<>(enumValues).randItem(rnd::nextInt); + } } |
