Exemple #1
0
 public static FRandom Next(FRandom previous, int minValue, int maxValue)
 {
     return(new FRandom(NextRanged(previous, minValue, maxValue), NewU(previous.U), NewV(previous.V)));
 }
Exemple #2
0
 private static int NextRanged(FRandom previous, int minValue, int maxValue)
 {
     return((int)(minValue + Next(previous.U, previous.V) * (maxValue - minValue)));
 }
Exemple #3
0
 /// <summary>
 /// Used for generating a sequence from a single known seed.
 /// Skip(0,...) is the same as Next, but Skip(1,...) is the same
 /// as calling Next twice but having to pass the result of the first
 /// one into the second.
 /// </summary>
 /// <param name="skip">Number of random numbers in sequence to skip</param>
 /// <param name="previous"></param>
 /// <param name="minValue"></param>
 /// <param name="maxValue"></param>
 /// <returns></returns>
 public static FRandom Skip(int skip, FRandom previous, int minValue, int maxValue)
 {
     return(skip <= 0 ?
            Next(previous, minValue, maxValue)
             : Skip(skip - 1, Next(previous, minValue, maxValue), minValue, maxValue));
 }