NormalDistribution class

Normal (Gaussian) continuous distribution with mean mean and standard deviation std, equivalent to scipy.stats.norm(loc=mean, scale=std).

References

  1. "scipy.stats.norm". https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.norm.html. Retrieved 2026-10-13.
  2. "Normal distribution". https://en.wikipedia.org/wiki/Normal_distribution. Retrieved 2026-10-13.
  3. P. J. Acklam, "An algorithm for computing the inverse normal cumulative distribution function". https://web.archive.org/web/20151030215612/http://home.online.no/~pjacklam/notes/invnorm/. Retrieved 2026-10-13.

Examples

var n = NormalDistribution(mean: 10.0, std: 2.0);

print(n.pdf(10.0));
print(n.cdf(12.0));
print(n.ppf(0.975));

/* output:
0.19947114020071635
0.8413447460685429
13.919927969080108
*/

Constructors

NormalDistribution({double mean = 0.0, double std = 1.0})
Creates a normal distribution. std must be positive.

Properties

hashCode → int
The hash code for this object.
no setterinherited
mean → double
Mean (location) of the distribution.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
std → double
Standard deviation (scale) of the distribution.
final
variance → double
Variance of the distribution.
no setter

Methods

cdf(double x) → double
Cumulative distribution function: probability of a value <= x.
cdfArray(Array x) → Array
Cumulative distribution function for each element of x.
interval(double confidence) → Array
Interval with the given confidence around the mean, as [ppf((1 - confidence) / 2), isf((1 - confidence) / 2)].
isf(double q) → double
Inverse survival function: the value with sf(value) == q, for q in [0, 1]. Accurate for small q.
logPdf(double x) → double
Logarithm of the probability density function at x.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pdf(double x) → double
Probability density function at x.
pdfArray(Array x) → Array
Probability density function for each element of x.
ppf(double p) → double
Percent point function (inverse of cdf): the value with cdf(value) == p, for p in [0, 1].
ppfArray(Array p) → Array
Percent point function for each element of p.
sample(int n, {Random? random}) → Array
n random samples of the distribution (Box-Muller transform). Pass a seeded random for reproducible samples.
sf(double x) → double
Survival function 1 - cdf(x), accurate in the upper tail.
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited