16 lines
495 B
C#
16 lines
495 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)
|
|
{
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override TNum ShapeFunction(TNum x) => CONSTANT * LAMBDA * TNum.Exp(-LAMBDA * x);
|
|
} |