2023-07-07 12:41:01 +00:00
|
|
|
using System.Numerics;
|
2020-10-31 23:08:30 +00:00
|
|
|
|
2023-07-06 08:26:12 +00:00
|
|
|
namespace FastRng.Distributions;
|
2020-10-31 23:08:30 +00:00
|
|
|
|
2023-07-07 12:41:01 +00:00
|
|
|
public sealed class ExponentialLa10<TNum> : Distribution<TNum> where TNum : IFloatingPointIeee754<TNum>
|
2023-07-06 08:26:12 +00:00
|
|
|
{
|
2023-07-07 12:41:01 +00:00
|
|
|
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
|
|
|
|
2023-07-07 12:41:01 +00:00
|
|
|
public ExponentialLa10(IRandom<TNum> rng) : base(rng)
|
2023-07-06 08:26:12 +00:00
|
|
|
{
|
2020-10-31 23:08:30 +00:00
|
|
|
}
|
2023-07-06 08:26:12 +00:00
|
|
|
|
2023-07-07 12:41:01 +00:00
|
|
|
private protected override TNum ShapeFunction(TNum x) => CONSTANT * LAMBDA * TNum.Exp(-LAMBDA * x);
|
2020-10-31 23:08:30 +00:00
|
|
|
}
|