public void Test1() { ConstValueDistribution <float> d = new ConstValueDistribution <float> { Value = -345 }; // Create 100 random values and check if they are valid. for (int i = 0; i < 100; i++) { float r = d.Next(RandomHelper.Random); Assert.AreEqual(-345, r); } Assert.AreEqual(-345, d.Value); d.Value = 10.5f; Assert.AreEqual(10.5f, d.Value); for (int i = 0; i < 100; i++) { float r = d.Next(RandomHelper.Random); Assert.AreEqual(10.5f, r); } }
public void RandomFromDistribution() { Distribution<float> distribution = new ConstValueDistribution<float>(123.456f); float f = RandomHelper.Next(null, distribution); Assert.AreEqual(123.456f, f); var random = new Random(123456); distribution = new UniformDistributionF(1.0f, 2.0f); f = random.Next(distribution); Assert.IsTrue(1.0f <= f && f <= 2.0f); }
public void RandomFromDistribution() { Distribution <float> distribution = new ConstValueDistribution <float>(123.456f); float f = RandomHelper.Next(null, distribution); Assert.AreEqual(123.456f, f); var random = new Random(123456); distribution = new UniformDistributionF(1.0f, 2.0f); f = random.Next(distribution); Assert.IsTrue(1.0f <= f && f <= 2.0f); }
public void Test1() { ConstValueDistribution<float> d = new ConstValueDistribution<float> { Value = -345 }; // Create 100 random values and check if they are valid. for (int i=0; i<100; i++) { float r = d.Next(RandomHelper.Random); Assert.AreEqual(-345, r); } Assert.AreEqual(-345, d.Value); d.Value = 10.5f; Assert.AreEqual(10.5f, d.Value); for (int i = 0; i < 100; i++) { float r = d.Next(RandomHelper.Random); Assert.AreEqual(10.5f, r); } }
public void Constructor() { var d = new ConstValueDistribution <float>(2.0f); Assert.AreEqual(2, d.Value); }
public void Constructor() { var d = new ConstValueDistribution<float>(2.0f); Assert.AreEqual(2, d.Value); }