コード例 #1
0
        public void Construction()
        {
            const UInt64 seedState = 578437695752307201ul;
            // This seed is from rust_rand, so we right shift them for compatibility.
            const UInt64 stream = 1157159078456920585ul >> 1;
            var          seed1  = new Pcg32.Seed(seedState, stream);
            var          rng1   = Pcg32.GetFactory().Create(seed1);

            Assert.Equal(1204678643940597513ul, rng1.NextUInt64());
            var seed2 = Pcg32.GetFactory().CreateSeed(rng1);

            seed2 = new Pcg32.Seed(seed2.State, seed2.Stream >> 1);
            var rng2 = Pcg32.GetFactory().Create(seed2);

            Assert.Equal(12384929573776311845ul, rng2.NextUInt64());
        }
コード例 #2
0
 public void NonNullable()
 {
     Assert.Throws <ArgumentNullException>(() => Pcg32.GetFactory().CreateSeed <StepRng>(null));
 }