コード例 #1
0
        public void ShuffleShouldHaveGoodDistribution()
        {
            double[] pickedValues = new double[TotalItems];
            for (int i = 0; i < TotalItems; i++)    // Simulate standard cubic dice rolls:
            {
                pickedValues[i] = rng.Roll(1, 6);
            }

            AssertTools.IsUniformishDistribution(pickedValues, 1, 6);
        }
コード例 #2
0
        public void OneInShouldHaveGoodDistribution()
        {
            double[] pickedValues = new double[TotalItems];
            for (int i = 0; i < TotalItems; i++)    // Simulate coin tosses:
            {
                pickedValues[i] = rng.OneIn(2) ? 1 : 0;
            }

            AssertTools.IsUniformishDistribution(pickedValues, 0, 1);
        }
コード例 #3
0
        public void NextsShouldHaveGoodDistribution()
        {
            double[] pickedValues = new double[TotalItems];
            for (int i = 0; i < TotalItems; i++)
            {
                pickedValues[i] = rng.NextSeveral(1, MinValue, MaxValue + 1);
            }

            AssertTools.IsUniformishDistribution(pickedValues, MinValue, MaxValue);
        }
コード例 #4
0
        public void NextItemFromCollectionShouldHaveGoodDistribution()
        {
            double[] pickedValues = new double[TotalItems];
            for (int i = 0; i < TotalItems; i++)
            {
                pickedValues[i] = rng.NextItem((ICollection <int>)values);   // Cast so a needed overload will be chosen
            }

            AssertTools.IsUniformishDistribution(pickedValues, MinValue, MaxValue);
        }
コード例 #5
0
        public void NextSubsetShouldHaveGoodDistribution()
        {
            const int subsetSize = 50;

            double[] pickedValues = new double[TotalItems];
            // Make lots of subsets:
            for (int subsetStart = 0; subsetStart < TotalItems; subsetStart += subsetSize)
            {
                var subset = rng.NextSubset(values, subsetSize).ToList();
                // And gather values from each subset:
                for (int i = 0; i < subset.Count; i++)
                {
                    pickedValues[subsetStart + i] = subset[i];
                }
            }

            AssertTools.IsUniformishDistribution(pickedValues, MinValue, MaxValue);
        }
コード例 #6
0
 public void IntervalDieDistributionShouldBeGood()
 {
     AssertTools.IsUniformishDistribution(rolls, interval.Minimum, interval.Maximum);
 }
コード例 #7
0
 public void D6DistributionShouldBeGood()
 {
     AssertTools.IsUniformishDistribution(rolls, d6.Minimum, d6.Maximum);
 }
コード例 #8
0
 public void D3D8Plus3ToEachDistributionShouldBeGood()
 {
     AssertTools.IsUniformishDistribution(rolls, c3d8ep3.Minimum, c3d8ep3.Maximum);
 }