Renamed
This commit is contained in:
parent
da39274262
commit
5f5291343d
@ -4,7 +4,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace FastRng.Double.Distributions
|
namespace FastRng.Double.Distributions
|
||||||
{
|
{
|
||||||
public sealed class Cauchy : IDistribution
|
public sealed class CauchyLorentz : IDistribution
|
||||||
{
|
{
|
||||||
private double scale = 1.0;
|
private double scale = 1.0;
|
||||||
|
|
@ -8,7 +8,7 @@ using NUnit.Framework;
|
|||||||
namespace FastRngTests.Double.Distributions
|
namespace FastRngTests.Double.Distributions
|
||||||
{
|
{
|
||||||
[ExcludeFromCodeCoverage]
|
[ExcludeFromCodeCoverage]
|
||||||
public class Cauchy
|
public class CauchyLorentz
|
||||||
{
|
{
|
||||||
public void TestCauchyDistribution01()
|
public void TestCauchyDistribution01()
|
||||||
{
|
{
|
||||||
@ -24,7 +24,7 @@ namespace FastRngTests.Double.Distributions
|
|||||||
var rng = new MultiThreadedRng();
|
var rng = new MultiThreadedRng();
|
||||||
var samples = new double[1_000];
|
var samples = new double[1_000];
|
||||||
for (var n = 0; n < samples.Length; n++)
|
for (var n = 0; n < samples.Length; n++)
|
||||||
samples[n] = await rng.NextNumber(-1.0, 1.0, new FastRng.Double.Distributions.Cauchy());
|
samples[n] = await rng.NextNumber(-1.0, 1.0, new FastRng.Double.Distributions.CauchyLorentz());
|
||||||
|
|
||||||
rng.StopProducer();
|
rng.StopProducer();
|
||||||
Assert.That(samples.Min(), Is.GreaterThanOrEqualTo(-1.0), "Min is out of range");
|
Assert.That(samples.Min(), Is.GreaterThanOrEqualTo(-1.0), "Min is out of range");
|
||||||
@ -39,7 +39,7 @@ namespace FastRngTests.Double.Distributions
|
|||||||
var rng = new MultiThreadedRng();
|
var rng = new MultiThreadedRng();
|
||||||
var samples = new double[1_000];
|
var samples = new double[1_000];
|
||||||
for (var n = 0; n < samples.Length; n++)
|
for (var n = 0; n < samples.Length; n++)
|
||||||
samples[n] = await rng.NextNumber(0.0, 1.0, new FastRng.Double.Distributions.Cauchy());
|
samples[n] = await rng.NextNumber(0.0, 1.0, new FastRng.Double.Distributions.CauchyLorentz());
|
||||||
|
|
||||||
rng.StopProducer();
|
rng.StopProducer();
|
||||||
Assert.That(samples.Min(), Is.GreaterThanOrEqualTo(0.0), "Min is out of range");
|
Assert.That(samples.Min(), Is.GreaterThanOrEqualTo(0.0), "Min is out of range");
|
||||||
@ -51,7 +51,7 @@ namespace FastRngTests.Double.Distributions
|
|||||||
[Category(TestCategories.NORMAL)]
|
[Category(TestCategories.NORMAL)]
|
||||||
public void ParameterTest01()
|
public void ParameterTest01()
|
||||||
{
|
{
|
||||||
var dist = new FastRng.Double.Distributions.Cauchy();
|
var dist = new FastRng.Double.Distributions.CauchyLorentz();
|
||||||
|
|
||||||
Assert.Throws<ArgumentOutOfRangeException>(() => dist.Scale = 0);
|
Assert.Throws<ArgumentOutOfRangeException>(() => dist.Scale = 0);
|
||||||
Assert.Throws<ArgumentOutOfRangeException>(() => dist.Scale = -78);
|
Assert.Throws<ArgumentOutOfRangeException>(() => dist.Scale = -78);
|
||||||
@ -68,7 +68,7 @@ namespace FastRngTests.Double.Distributions
|
|||||||
[Category(TestCategories.NORMAL)]
|
[Category(TestCategories.NORMAL)]
|
||||||
public async Task NoRandomNumberGenerator01()
|
public async Task NoRandomNumberGenerator01()
|
||||||
{
|
{
|
||||||
var dist = new FastRng.Double.Distributions.Cauchy();
|
var dist = new FastRng.Double.Distributions.CauchyLorentz();
|
||||||
Assert.DoesNotThrowAsync(async () => await dist.GetDistributedValue());
|
Assert.DoesNotThrowAsync(async () => await dist.GetDistributedValue());
|
||||||
Assert.That(await dist.GetDistributedValue(), Is.NaN);
|
Assert.That(await dist.GetDistributedValue(), Is.NaN);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user