コード例 #1
0
        public static int RandomInt(ref ulong seed, int max)
        {
            int num;
            int num1;

            if ((max & -max) == max)
            {
                return((int)((long)max * (long)Utils.RandomNext(ref seed, 31) >> 31));
            }
            do
            {
                num  = Utils.RandomNext(ref seed, 31);
                num1 = num % max;
            }while (num - num1 + (max - 1) < 0);
            return(num1);
        }
コード例 #2
0
 public static float RandomFloat(ref ulong seed)
 {
     return((float)Utils.RandomNext(ref seed, 24) / 16777216f);
 }