FastRng/FastRng/Distributions/ExponentialLa10.cs

15 lines
483 B
C#

using System.Numerics;
namespace FastRng.Distributions;
public sealed class ExponentialLa10<TNum> : Distribution<TNum> where TNum : IFloatingPointIeee754<TNum>
{
private static readonly TNum LAMBDA = TNum.CreateChecked(10.0f);
private static readonly TNum CONSTANT = TNum.CreateChecked(0.1106f);
public ExponentialLa10(IRandom<TNum> rng) : base(rng)
{
}
private protected override TNum ShapeFunction(TNum x) => CONSTANT * LAMBDA * TNum.Exp(-LAMBDA * x);
}