using System; using MathNet.Numerics.Distributions; using Ringtoets.Piping.Data.Properties; namespace Ringtoets.Piping.Data.Probabilistics { /// /// Class representing a log-normal distribution. /// public class LognormalDistribution : IDistribution { private double standardDeviation; /// /// Initializes a new instance of the class, /// initialized as the standard log-normal distribution. /// public LognormalDistribution() { Mean = 0.0; StandardDeviation = 1.0; } /// /// Gets or sets the mean (μ) of the distribution. /// public double Mean { get; set; } /// /// Gets or sets the standard deviation (σ) of the distribution. /// public double StandardDeviation { get { return standardDeviation; } set { if (value <= 0) { throw new ArgumentException(Resources.StandardDeviation_Should_be_greater_than_zero); } standardDeviation = value; } } public virtual double InverseCDF(double p) { if (p < 0.0 || p > 1) { throw new ArgumentOutOfRangeException("p", Resources.IDistribution_InverseCDF_Probability_must_be_in_range); } return LogNormal.InvCDF(Mean, StandardDeviation, p); } } }