Esempio n. 1
0
        private void RandRangeTest(IRandom Rand, int Iterations = 1000)
        {
            byte[] data;
            int x;
            long y;
            int min, max;
            min = Rand.Next(33);
            max = Rand.Next(34, 111);

            for (int i = 0; i < Iterations; i++)
                data = Rand.GetBytes(i * 10);

            for (int i = 1; i < Iterations; i++)
            {
                x = Rand.Next(i * min, i * max);
                if (x > i * max)
                    throw new Exception(Rand.Name + ":Next returned a value above of the expected range.");
                if (x < i * min)
                    throw new Exception(Rand.Name + ":Next returned a value below of the expected range.");
                y = Rand.NextLong(i * min, i * max);
                if (y > i * max)
                    throw new Exception(Rand.Name + ":NextLong returned a value above of the expected range.");
                if (y < i * min)
                    throw new Exception(Rand.Name + ":NextLong returned a value below of the expected range.");
            }
        }