Esempio n. 1
0
        public void TestMT19937IntegerOutput()
        {
            var testNumbers = new List <ulong>();

            foreach (var l in File.ReadLines(_IntFile).Skip(1))
            {
                var values = l.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                for (var i = 0; i < values.Length; i++)
                {
                    testNumbers.Add(ulong.Parse(values[i]));
                }
            }
            ulong[] init = { 0x12345UL, 0x23456UL, 0x34567UL, 0x45678UL };
            var     mt   = new MersenneTwister64(init, 4);

            for (var i = 0; i < testNumbers.Count; i++)
            {
                Assert.Equal(testNumbers[i], mt.GenerateInteger());
            }
        }
Esempio n. 2
0
 private MersenneTwister64(MersenneTwister64 other)
 {
     _idx = other._idx;
     Buffer.BlockCopy(other._mt, 0, _mt, 0, SeedLength);
 }