public void LinearFeedbackShiftRegister16EnumerableReturnsCorrectValues() { LinearFeedbackShiftRegister16 a = new LinearFeedbackShiftRegister16(123); LinearFeedbackShiftRegister16 b = new LinearFeedbackShiftRegister16(123); foreach (var value in b) Assert.AreEqual(a.NextRandom(), value); }
public void LinearFeedbackShiftRegister16EnumerableReturnsCorrectValues() { LinearFeedbackShiftRegister16 a = new LinearFeedbackShiftRegister16(123); LinearFeedbackShiftRegister16 b = new LinearFeedbackShiftRegister16(123); foreach (var value in b) { Assert.AreEqual(a.NextRandom(), value); } }
public static void LinearFeedbackShiftRegister16LoopsAfter2Pow16Values() { LinearFeedbackShiftRegister16 r = new LinearFeedbackShiftRegister16(); UInt16 first = r.NextRandom(); UInt16 value; int period = 0; do { value = r.NextRandom(); ++period; } while (value != first); Assert.AreEqual(LinearFeedbackShiftRegister16.Period, period); }
public static void LinearFeedbackShiftRegister16LoopsAfter2Pow16Values() { LinearFeedbackShiftRegister16 r = new LinearFeedbackShiftRegister16(); UInt16 first = r.NextRandom(); UInt16 value; int period = 0; do { value = r.NextRandom(); ++period; } while (value != first); Assert.AreEqual(LinearFeedbackShiftRegister16.PERIOD, period); }