Expand description

This crate aims to be a functional port of the Math.NET Numerics Distribution package and in doing so providing the Rust numerical computing community with a robust, well-tested statistical distribution package. This crate also ports over some of the special statistical functions from Math.NET in so far as they are used in the computation of distribution values. This crate depends on the rand crate to provide RNG.


The following example samples from a standard normal distribution

use rand::distributions::Distribution;
use statrs::distribution::Normal;

let mut r = rand::thread_rng();
let n = Normal::new(0.0, 1.0).unwrap();
for _ in 0..10 {
    print!("{}", n.sample(&mut r));


Defines mathematical expressions commonly used when computing distribution values as constants

Defines common interfaces for interacting with statistical distributions and provides concrete implementations for a variety of distributions.

Provides number theory utility functions

Provides a host of special statistical functions (e.g. the beta function or the error function)

Provides utility functions for generating data sequences

Provides utility functions for working with floating point precision

Provides traits for statistical computation



Enumeration of possible errors thrown within the statrs library

Type Definitions

Result type for the statrs library package that returns either a result type T or a StatsError