Exemplo n.º 1
0
        public void NextMinMax_MinVal()
        {
            var rng = new ConstantRandomSource(0UL);
            int x   = rng.Next(123, 1_234_567);

            Assert.Equal(123, x);
        }
Exemplo n.º 2
0
        public void NextInt_MinVal()
        {
            var rng = new ConstantRandomSource(0UL);
            int x   = rng.Next();

            Assert.Equal(0, x);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
        }