pub trait DiscreteCDF<K: Bounded + Clone + Num, T: Float>: Min<K> + Max<K> {
    fn cdf(&self, x: K) -> T;

    fn inverse_cdf(&self, p: T) -> K { ... }
}
Expand description

The DiscreteCDF trait is used to specify an interface for univariate discrete distributions.

Required methods

Returns the cumulative distribution function calculated at x for a given distribution. May panic depending on the implementor.

Examples
use statrs::distribution::{ContinuousCDF, Uniform};

let n = Uniform::new(0.0, 1.0).unwrap();
assert_eq!(0.5, n.cdf(0.5));

Provided methods

Due to issues with rounding and floating-point accuracy the default implementation may be ill-behaved Specialized inverse cdfs should be used whenever possible.

Implementors