コード例 #1
0
        public T roll(bool use_empty = false)
        {
            int sum_of_weights = 0;

            for (var row = 0; row < probabilityTable.Count; row++)
            {
                sum_of_weights += probabilityTable[row].Item1;
            }

            int x = AppRandom.GetRandomNumber(0, use_empty ? 100 : sum_of_weights);

            return(lookupValue(x));
        }
コード例 #2
0
 public static double GetRandomDouble()
 {
     return(AppRandom.GetRandomDouble());
 }
コード例 #3
0
 public static byte GetRandomByte(byte min, byte max)
 {
     return((byte)AppRandom.GetRandomNumber(min, max));
 }
コード例 #4
0
 //==============================================================================================
 // RANDOM HELPER FUNCTIONS
 //==============================================================================================
 public static int GetRandomNumber(int min, int max)
 {
     return(AppRandom.GetRandomNumber(min, max));
 }