示例#1
0
        public void NextFloatNonZero_Max()
        {
            var    rng = new ConstantRandomSource(ulong.MaxValue);
            double x   = rng.NextFloatNonZero();

            Assert.Equal(1f, x);
        }
示例#2
0
        public void NextDoubleNonZero_Min()
        {
            var    rng = new ConstantRandomSource(0UL);
            double x   = rng.NextDoubleNonZero();

            Assert.Equal(INCR_DOUBLE, x);
        }
示例#3
0
        public void NextUInt_MinVal()
        {
            var  rng = new ConstantRandomSource(0UL);
            uint x   = rng.NextUInt();

            Assert.Equal(0u, x);
        }
示例#4
0
        public void NextFloatNonZero_Min()
        {
            var    rng = new ConstantRandomSource(0UL);
            double x   = rng.NextFloatNonZero();

            Assert.Equal(INCR_FLOAT, x);
        }
示例#5
0
        public void NextByte_MaxVal()
        {
            var  rng = new ConstantRandomSource(0xFFUL << 56);
            byte x   = rng.NextByte();

            Assert.Equal(255, x);
        }
示例#6
0
        public void NextFloat_MinVal()
        {
            var   rng = new ConstantRandomSource(0UL);
            float x   = rng.NextFloat();

            Assert.Equal(0f, x);
        }
示例#7
0
        public void NextBool_False()
        {
            var  rng = new ConstantRandomSource(0UL);
            bool x   = rng.NextBool();

            Assert.False(x);
        }
示例#8
0
        public void NextByte_MinVal()
        {
            var  rng = new ConstantRandomSource(0UL);
            byte x   = rng.NextByte();

            Assert.Equal(0, x);
        }
示例#9
0
        public void NextULong_MaxVal()
        {
            var   rng = new ConstantRandomSource(ulong.MaxValue);
            ulong x   = rng.NextULong();

            Assert.Equal(ulong.MaxValue, x);
        }
示例#10
0
        public void NextULong_MinVal()
        {
            var   rng = new ConstantRandomSource(0UL);
            ulong x   = rng.NextULong();

            Assert.Equal(0UL, x);
        }
示例#11
0
        public void NextUInt_MaxVal()
        {
            var  rng = new ConstantRandomSource(ulong.MaxValue);
            uint x   = rng.NextUInt();

            Assert.Equal(uint.MaxValue, x);
        }
示例#12
0
        public void NextDoubleHighRes_Max()
        {
            var    rng = new ConstantRandomSource(ulong.MaxValue);
            double x   = rng.NextDoubleHighRes();

            Assert.Equal(1.0, x);
        }
示例#13
0
        public void NextFloat_MaxVal()
        {
            var   rng = new ConstantRandomSource(ulong.MaxValue);
            float x   = rng.NextFloat();

            Assert.Equal(1.0 - INCR_FLOAT, x);
        }
示例#14
0
        public void NextDouble_MinVal()
        {
            var    rng = new ConstantRandomSource(0UL);
            double x   = rng.NextDouble();

            Assert.Equal(0.0, x);
        }
示例#15
0
        public void NextDouble_MaxVal()
        {
            var    rng = new ConstantRandomSource(ulong.MaxValue);
            double x   = rng.NextDouble();

            Assert.Equal(1.0 - INCR_DOUBLE, x);
        }
示例#16
0
        public void NextMinMax_MinVal()
        {
            var rng = new ConstantRandomSource(0UL);
            int x   = rng.Next(123, 1_234_567);

            Assert.Equal(123, x);
        }
示例#17
0
        public void NextMax_MaxVal()
        {
            const int max = 1_234_567;
            var       rng = new ConstantRandomSource(((ulong)(max - 1)) << 43);
            int       x   = rng.Next(max);

            Assert.Equal(max - 1, x);
        }
示例#18
0
        public void NextMinMax_LongRange_MinVal()
        {
            const int maxValHalf = int.MaxValue / 2;
            const int lowerBound = -maxValHalf;
            const int upperBound = maxValHalf + 123;

            var rng = new ConstantRandomSource(0UL);
            int x   = rng.Next(lowerBound, upperBound);

            Assert.Equal(lowerBound, x);
        }