diff --git a/FastRng/Double/Distributions/ChiSquare.cs b/FastRng/Double/Distributions/ChiSquare.cs index 2a6b568..3d70e97 100644 --- a/FastRng/Double/Distributions/ChiSquare.cs +++ b/FastRng/Double/Distributions/ChiSquare.cs @@ -5,10 +5,22 @@ namespace FastRng.Double.Distributions { public sealed class ChiSquare : IDistribution { + private double degreesOfFreedom = 1.0; + public IRandom Random { get; set; } - public double DegreesOfFreedom { get; set; } = 1.0; - + public double DegreesOfFreedom + { + get => this.degreesOfFreedom; + set + { + if(value <= 0.0) + throw new ArgumentOutOfRangeException(message: "DegreesOfFreedom must be greater than 0", null); + + this.degreesOfFreedom = value; + } + } + public async ValueTask GetDistributedValue(CancellationToken token) { if (this.Random == null)