Package w.util

Class RandomUtils

java.lang.Object
w.util.RandomUtils

public class RandomUtils extends Object
Author:
whilein
  • Constructor Details

    • RandomUtils

      public RandomUtils()
  • Method Details

    • getSecureRandom

      @NotNull public @NotNull SecureRandom getSecureRandom()
    • getRandom

      @NotNull public @NotNull Random 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

      @Nullable public static <T> T removeRandomElement(@Nullable @Nullable List<T> list)
    • 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

      public <T> T getRandomElement(@NotNull @NotNull List<T> list)
    • getElement

      @Deprecated public <T> T getElement(T @NotNull [] array)
      Deprecated.
      See Also:
    • getElement

      @Deprecated public <T> T getElement(@NotNull @NotNull List<T> list)
      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()