Refactored

This commit is contained in:
tsommer committed 2020-10-30 21:50:10 +01:00
1 parent b84b488025
commit c364c206ad
2 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -23,7 +23,7 @@ namespace FastRng.Double.Distributions
set
{
this.random = value;
this.fitter = new ShapeFitter(BetaA2B2.ShapeFunction, this.random, 50, 0.99);
this.fitter = new ShapeFitter(BetaA2B2.ShapeFunction, this.random, 100);
}
}
+3 -3
View File
@@ -7,7 +7,7 @@ namespace FastRng.Double.Distributions
{
public sealed class Normal : IDistribution
{
private const double SQRT_2PI = 2.506628275;
private const double SQRT_2_PI = 2.506628275;
private const double STDDEV = 0.2;
private const double MEAN = 0.5;
@@ -24,11 +24,11 @@ namespace FastRng.Double.Distributions
set
{
this.random = value;
this.fitter = new ShapeFitter(Normal.ShapeFunction, this.random, 50, 1.93);
this.fitter = new ShapeFitter(Normal.ShapeFunction, this.random, 100);
}
}
private static double ShapeFunction(double x) => 1.0 / (STDDEV * SQRT_2PI) * Math.Exp(-0.5 * Math.Pow((x - MEAN) / STDDEV, 2.0));
private static double ShapeFunction(double x) => 1.0 / (STDDEV * SQRT_2_PI) * Math.Exp(-0.5 * Math.Pow((x - MEAN) / STDDEV, 2.0));
public async ValueTask<double> GetDistributedValue(CancellationToken token = default)
{