public static T RandomOrDefault <T>(this IEnumerable <T> source, ConstantRandom crng) { T current = default(T); int count = 0; crng.Reseed(); foreach (T element in source) { if (crng.Next(++count) == 0) { current = element; } } return(current); }
protected KIController(float interval, GDGameScreen owner, Cannon cannon, Fraction fraction, float minRotDelta) : base(interval, owner, cannon, fraction, true) { MinimumRotationalDelta = minRotDelta; crng = new ConstantRandom(cannon); }