Struct rv::dist::Uniform[][src]

pub struct Uniform { /* fields omitted */ }

Continuous uniform distribution, U(a, b) on the interval x in [a, b]

Example

The Uniform CDF is a line

use rv::prelude::*;

let u = Uniform::new(2.0, 4.0).unwrap();

// A line representing the CDF
let y = |x: f64| { 0.5 * x - 1.0 };

assert!((u.cdf(&3.0_f64) - y(3.0)).abs() < 1E-12);
assert!((u.cdf(&3.2_f64) - y(3.2)).abs() < 1E-12);

Implementations

impl Uniform[src]

pub fn new(a: f64, b: f64) -> Result<Self, UniformError>[src]

Create a new uniform distribution on [a, b]

pub fn new_unchecked(a: f64, b: f64) -> Self[src]

Creates a new Uniform without checking whether the parameters are valid.

pub fn a(&self) -> f64[src]

Get the lower bound, a

Example

let u = Uniform::new(0.0, 1.0).unwrap();
assert_eq!(u.a(), 0.0);

pub fn b(&self) -> f64[src]

Get the upper bound, b

Example

let u = Uniform::new(0.0, 1.0).unwrap();
assert_eq!(u.b(), 1.0);

Trait Implementations

impl Cdf<f32> for Uniform[src]

impl Cdf<f64> for Uniform[src]

impl Clone for Uniform[src]

impl ContinuousDistr<f32> for Uniform[src]

impl ContinuousDistr<f64> for Uniform[src]

impl Debug for Uniform[src]

impl Default for Uniform[src]

impl Display for Uniform[src]

impl Entropy for Uniform[src]

impl InverseCdf<f32> for Uniform[src]

impl InverseCdf<f64> for Uniform[src]

impl Kurtosis for Uniform[src]

impl Mean<f32> for Uniform[src]

impl Mean<f64> for Uniform[src]

impl Median<f32> for Uniform[src]

impl Median<f64> for Uniform[src]

impl PartialEq<Uniform> for Uniform[src]

impl Rv<f32> for Uniform[src]

impl Rv<f64> for Uniform[src]

impl Skewness for Uniform[src]

impl Support<f32> for Uniform[src]

impl Support<f64> for Uniform[src]

impl Variance<f32> for Uniform[src]

impl Variance<f64> for Uniform[src]

Auto Trait Implementations

impl RefUnwindSafe for Uniform

impl Send for Uniform

impl Sync for Uniform

impl Unpin for Uniform

impl UnwindSafe for Uniform

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,