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); }
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); }
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); }
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); }
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); }
public void IntervalDieDistributionShouldBeGood() { AssertTools.IsUniformishDistribution(rolls, interval.Minimum, interval.Maximum); }
public void D6DistributionShouldBeGood() { AssertTools.IsUniformishDistribution(rolls, d6.Minimum, d6.Maximum); }
public void D3D8Plus3ToEachDistributionShouldBeGood() { AssertTools.IsUniformishDistribution(rolls, c3d8ep3.Minimum, c3d8ep3.Maximum); }