FastRng/FastRng/Distributions/ExponentialLa10.cs

15 lines
483 B
C#
Raw Normal View History

using System.Numerics;
2020-10-31 23:08:30 +00:00
namespace FastRng.Distributions;
2020-10-31 23:08:30 +00:00
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);
2020-11-08 15:23:05 +00:00
public ExponentialLa10(IRandom<TNum> rng) : base(rng)
{
2020-10-31 23:08:30 +00:00
}
private protected override TNum ShapeFunction(TNum x) => CONSTANT * LAMBDA * TNum.Exp(-LAMBDA * x);
2020-10-31 23:08:30 +00:00
}