/// <summary> /// 返回一个有限,非负数。 /// </summary> /// <param name="minValue"></param> /// <param name="maxValue"></param> /// <returns></returns> public int Next(int minValue, int maxValue) { if (minValue == maxValue) { return(minValue); } int next = random.Next(minValue, maxValue); //base.GetInt32(minValue, maxValue); if (list.Count >= maxValue - minValue) { return(next); } if (list.Contains(next)) { return(Next(minValue, maxValue)); } list.Add(next); return(next); }
/// <summary> /// Generates 2 random numbers and assign each one to the point property for the challengers arguments provided /// </summary> /// <param name="challengerX">The First challenger</param> /// <param name="challengerY">The Second challenger</param> public void GenerateAndAssignPoints(Challenger challengerX, Challenger challengerY) { Troschuetz.Random.Generators.StandardGenerator generator = new Troschuetz.Random.Generators.StandardGenerator(); challengerX.Points = generator.Next(); challengerY.Points = generator.Next(); }