Renamed normal distribution
This commit is contained in:
parent
a710226941
commit
3bf829d684
@ -5,7 +5,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace FastRng.Double.Distributions
|
||||
{
|
||||
public sealed class Normal : IDistribution
|
||||
public sealed class NormalS02M05 : IDistribution
|
||||
{
|
||||
private const double SQRT_2_PI = 2.506628275;
|
||||
private const double STDDEV = 0.2;
|
||||
@ -14,7 +14,7 @@ namespace FastRng.Double.Distributions
|
||||
private ShapeFitter fitter;
|
||||
private IRandom random;
|
||||
|
||||
public Normal()
|
||||
public NormalS02M05()
|
||||
{
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ namespace FastRng.Double.Distributions
|
||||
set
|
||||
{
|
||||
this.random = value;
|
||||
this.fitter = new ShapeFitter(Normal.ShapeFunction, this.random, 100);
|
||||
this.fitter = new ShapeFitter(NormalS02M05.ShapeFunction, this.random, 100);
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ using NUnit.Framework;
|
||||
namespace FastRngTests.Double.Distributions
|
||||
{
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class Normal
|
||||
public class NormalS02M05
|
||||
{
|
||||
[Test]
|
||||
[Category(TestCategories.COVER)]
|
||||
@ -18,7 +18,7 @@ namespace FastRngTests.Double.Distributions
|
||||
const double MEAN = 0.5;
|
||||
const double STANDARD_DEVIATION = 0.2;
|
||||
|
||||
var dist = new FastRng.Double.Distributions.Normal();
|
||||
var dist = new FastRng.Double.Distributions.NormalS02M05();
|
||||
var stats = new RunningStatistics();
|
||||
var fra = new FrequencyAnalysis();
|
||||
var rng = new MultiThreadedRng();
|
||||
@ -47,7 +47,7 @@ namespace FastRngTests.Double.Distributions
|
||||
{
|
||||
var rng = new MultiThreadedRng();
|
||||
var samples = new double[1_000];
|
||||
var dist = new FastRng.Double.Distributions.Normal();
|
||||
var dist = new FastRng.Double.Distributions.NormalS02M05();
|
||||
for (var n = 0; n < samples.Length; n++)
|
||||
samples[n] = await rng.NextNumber(-1.0, 1.0, dist);
|
||||
|
||||
@ -63,7 +63,7 @@ namespace FastRngTests.Double.Distributions
|
||||
{
|
||||
var rng = new MultiThreadedRng();
|
||||
var samples = new double[1_000];
|
||||
var dist = new FastRng.Double.Distributions.Normal();
|
||||
var dist = new FastRng.Double.Distributions.NormalS02M05();
|
||||
for (var n = 0; n < samples.Length; n++)
|
||||
samples[n] = await rng.NextNumber(0.0, 1.0, dist);
|
||||
|
||||
@ -78,7 +78,7 @@ namespace FastRngTests.Double.Distributions
|
||||
public async Task TestNormalGeneratorWithRange03()
|
||||
{
|
||||
var rng = new MultiThreadedRng();
|
||||
var dist = new FastRng.Double.Distributions.Normal { Random = rng }; // Test default parameters
|
||||
var dist = new FastRng.Double.Distributions.NormalS02M05 { Random = rng }; // Test default parameters
|
||||
|
||||
var samples = new double[1_000];
|
||||
for (var n = 0; n < samples.Length; n++)
|
||||
@ -94,7 +94,7 @@ namespace FastRngTests.Double.Distributions
|
||||
[Category(TestCategories.NORMAL)]
|
||||
public async Task NoRandomNumberGenerator01()
|
||||
{
|
||||
var dist = new FastRng.Double.Distributions.Normal();
|
||||
var dist = new FastRng.Double.Distributions.NormalS02M05();
|
||||
Assert.DoesNotThrowAsync(async () => await dist.GetDistributedValue());
|
||||
Assert.That(await dist.GetDistributedValue(), Is.NaN);
|
||||
}
|
@ -170,19 +170,19 @@ namespace FastRngTests.Double
|
||||
Assert.That(wasCanceled, Is.True, "The consumer was not canceled");
|
||||
|
||||
var tokenSource2 = new CancellationTokenSource(TimeSpan.FromSeconds(3));
|
||||
await rng.NextNumber(new Normal(), tokenSource2.Token);
|
||||
await rng.NextNumber(new NormalS02M05(), tokenSource2.Token);
|
||||
Assert.That(tokenSource2.IsCancellationRequested, Is.True);
|
||||
|
||||
tokenSource2 = new CancellationTokenSource(TimeSpan.FromSeconds(3));
|
||||
await rng.NextNumber(-1d, 1d, new Normal(), tokenSource2.Token);
|
||||
await rng.NextNumber(-1d, 1d, new NormalS02M05(), tokenSource2.Token);
|
||||
Assert.That(tokenSource2.IsCancellationRequested, Is.True);
|
||||
|
||||
tokenSource2 = new CancellationTokenSource(TimeSpan.FromSeconds(3));
|
||||
await rng.NextNumber(0u, 6u, new Normal(), tokenSource2.Token);
|
||||
await rng.NextNumber(0u, 6u, new NormalS02M05(), tokenSource2.Token);
|
||||
Assert.That(tokenSource2.IsCancellationRequested, Is.True);
|
||||
|
||||
tokenSource2 = new CancellationTokenSource(TimeSpan.FromSeconds(3));
|
||||
await rng.NextNumber(0ul, 6ul, new Normal(), tokenSource2.Token);
|
||||
await rng.NextNumber(0ul, 6ul, new NormalS02M05(), tokenSource2.Token);
|
||||
Assert.That(tokenSource2.IsCancellationRequested, Is.True);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user