public async Task TestStudentTDistribution01() { using var rng = new MultiThreadedRng(); var dist = new FastRng.Double.Distributions.StudentTNu1(rng); var fra = new FrequencyAnalysis(); for (var n = 0; n < 100_000; n++) { fra.CountThis(await dist.NextNumber()); } var result = fra.NormalizeAndPlotEvents(TestContext.WriteLine); Assert.That(result[0], Is.EqualTo(1.000000000).Within(0.2)); Assert.That(result[1], Is.EqualTo(0.999700120).Within(0.2)); Assert.That(result[2], Is.EqualTo(0.999200719).Within(0.2)); Assert.That(result[21], Is.EqualTo(0.953929798).Within(0.2)); Assert.That(result[22], Is.EqualTo(0.949852788).Within(0.2)); Assert.That(result[23], Is.EqualTo(0.945631619).Within(0.2)); Assert.That(result[50], Is.EqualTo(0.793667169).Within(0.095)); Assert.That(result[75], Is.EqualTo(0.633937627).Within(0.09)); Assert.That(result[85], Is.EqualTo(0.574902276).Within(0.09)); Assert.That(result[90], Is.EqualTo(0.547070729).Within(0.09)); Assert.That(result[97], Is.EqualTo(0.510150990).Within(0.09)); Assert.That(result[98], Is.EqualTo(0.505075501).Within(0.09)); Assert.That(result[99], Is.EqualTo(0.500050000).Within(0.09)); }
public async Task TestStudentTGeneratorWithRange01() { using var rng = new MultiThreadedRng(); var dist = new FastRng.Double.Distributions.StudentTNu1(rng); var samples = new double[1_000];