static void ReadAndTestRandom <T>(ITitanicArray <T> arr, IDataIterator <T> iter) { long len = arr.Length; var seq = LinearFeedbackShiftRegister.SequenceLength(lfsrStart, (ulong)len).GetEnumerator(); iter.Reset(); for (long i = 0; i < len; i++) { seq.MoveNext(); long x = (long)seq.Current; T next = iter.GetNext(); Assert.IsTrue(iter.AreEqual(arr[x], next)); } }
static void WriteRandom <T>(ITitanicArray <T> arr, IDataIterator <T> iter) { long len = arr.Length; var seq = LinearFeedbackShiftRegister.SequenceLength(lfsrStart, (ulong)len).GetEnumerator(); iter.Reset(); for (long i = 0; i < len; i++) { seq.MoveNext(); long x = (long)seq.Current; T next = iter.GetNext(); arr[x] = next; } }