public void GenerateTest() { ExponentialDistribution target = new ExponentialDistribution(2.5); double[] samples = target.Generate(1000000); var actual = ExponentialDistribution.Estimate(samples); actual.Fit(samples); Assert.AreEqual(2.5, actual.Rate, 0.01); }
public void GenerateTest2() { ExponentialDistribution target = new ExponentialDistribution(2.5); double[] samples = new double[1000000]; for (int i = 0; i < samples.Length; i++) { samples[i] = target.Generate(); } var actual = ExponentialDistribution.Estimate(samples); actual.Fit(samples); Assert.AreEqual(2.5, actual.Rate, 0.01); }