Package tilda.utils

Class RandomUtil


  • public class RandomUtil
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static java.util.Random _R  
    • Constructor Summary

      Constructors 
      Constructor Description
      RandomUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean flip()  
      static boolean pick​(double Odds)
      picks a random number and returns true if that is < Odds, or false otherwise.
      static double pick​(double Min, double Max)  
      static int pick​(int Min, int Max)  
      static <T> T pick​(java.util.List<T> L)  
      static <T> T pick​(T[] A)  
      static short pickNonZeroShort()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • _R

        protected static java.util.Random _R
    • Constructor Detail

      • RandomUtil

        public RandomUtil()
    • Method Detail

      • flip

        public static boolean flip()
      • pick

        public static <T> T pick​(java.util.List<T> L)
      • pick

        public static <T> T pick​(T[] A)
      • pick

        public static int pick​(int Min,
                               int Max)
      • pick

        public static boolean pick​(double Odds)
        picks a random number and returns true if that is < Odds, or false otherwise. So, calling with 0.75 means a 75% chance true Vs. false
        Parameters:
        Odds - a number between 0 and 1
        Returns:
      • pick

        public static double pick​(double Min,
                                  double Max)
      • pickNonZeroShort

        public static short pickNonZeroShort()