Package w.util
Class RandomUtils
java.lang.Object
w.util.RandomUtils
- Author:
- whilein
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean<T> TgetElement(@NotNull List<T> list) Deprecated.<T> TgetElement(T @NotNull [] array) Deprecated.intgetInt()intgetInt(int bound) intgetInt(int min, int max) chargetLetter(boolean upperCase) char@NotNull RandombooleangetRandomElement(boolean @NotNull [] array) bytegetRandomElement(byte @NotNull [] array) doublegetRandomElement(double @NotNull [] array) floatgetRandomElement(float @NotNull [] array) intgetRandomElement(int @NotNull [] array) longgetRandomElement(long @NotNull [] array) shortgetRandomElement(short @NotNull [] array) <T> TgetRandomElement(@NotNull List<T> list) <T> TgetRandomElement(T @NotNull [] array) <T> @NotNull Collection<T>getRandomElements(@NotNull Collection<T> collection, int count, boolean distinct) <T> @NotNull Collection<T>getRandomElements(@NotNull List<T> list, int count, boolean distinct) <T> @NotNull Collection<T>getRandomElements(T @NotNull [] array, int count, boolean distinct) @NotNull SecureRandomstatic <T> TremoveRandomElement(@Nullable List<T> list) <T> TweightedRandom(@NotNull Collection<T> items, @NotNull ToDoubleFunction<T> weightCalculator)
-
Constructor Details
-
RandomUtils
public RandomUtils()
-
-
Method Details
-
getSecureRandom
-
getRandom
-
getRandomElements
@NotNull public <T> @NotNull Collection<T> getRandomElements(T @NotNull [] array, int count, boolean distinct) -
getRandomElements
@NotNull public <T> @NotNull Collection<T> getRandomElements(@NotNull @NotNull List<T> list, int count, boolean distinct) -
removeRandomElement
-
getRandomElements
@NotNull public <T> @NotNull Collection<T> getRandomElements(@NotNull @NotNull Collection<T> collection, int count, boolean distinct) -
weightedRandom
@Nullable public <T> T weightedRandom(@NotNull @NotNull Collection<T> items, @NotNull @NotNull ToDoubleFunction<T> weightCalculator) -
getRandomElement
public boolean getRandomElement(boolean @NotNull [] array) -
getRandomElement
public byte getRandomElement(byte @NotNull [] array) -
getRandomElement
public short getRandomElement(short @NotNull [] array) -
getRandomElement
public int getRandomElement(int @NotNull [] array) -
getRandomElement
public long getRandomElement(long @NotNull [] array) -
getRandomElement
public float getRandomElement(float @NotNull [] array) -
getRandomElement
public double getRandomElement(double @NotNull [] array) -
getRandomElement
public <T> T getRandomElement(T @NotNull [] array) -
getRandomElement
-
getElement
Deprecated.- See Also:
-
getElement
Deprecated.- See Also:
-
getInt
public int getInt(int min, int max) -
getLetter
public char getLetter(boolean upperCase) -
getNumber
public char getNumber() -
getInt
public int getInt(int bound) -
getInt
public int getInt() -
getBoolean
public boolean getBoolean()
-