Struct statrs::distribution::Uniform [−][src]
Implements the Continuous Uniform distribution
Examples
use statrs::distribution::{Uniform, Continuous}; use statrs::statistics::Mean; let n = Uniform::new(0.0, 1.0).unwrap(); assert_eq!(n.mean(), 0.5); assert_eq!(n.pdf(0.5), 1.0);
Implementations
impl Uniform
[src]
pub fn new(min: f64, max: f64) -> Result<Uniform>
[src]
Constructs a new uniform distribution with a min of min
and a max
of max
Errors
Returns an error if min
or max
are NaN
Examples
use statrs::distribution::Uniform; use std::f64; let mut result = Uniform::new(0.0, 1.0); assert!(result.is_ok()); result = Uniform::new(f64::NAN, f64::NAN); assert!(result.is_err());
Trait Implementations
impl Clone for Uniform
[src]
impl Continuous<f64, f64> for Uniform
[src]
fn pdf(&self, x: f64) -> f64
[src]
Calculates the probability density function for the continuous uniform
distribution at x
Remarks
Returns 0.0
if x
is not in [min, max]
Formula
ⓘ
1 / (max - min)
fn ln_pdf(&self, x: f64) -> f64
[src]
impl Copy for Uniform
[src]
impl Debug for Uniform
[src]
impl Distribution<f64> for Uniform
[src]
fn sample<R: Rng + ?Sized>(&self, r: &mut R) -> f64
[src]
pub fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
R: Rng,
[src]
R: Rng,
impl Entropy<f64> for Uniform
[src]
impl Max<f64> for Uniform
[src]
impl Mean<f64> for Uniform
[src]
impl Median<f64> for Uniform
[src]
impl Min<f64> for Uniform
[src]
impl Mode<f64> for Uniform
[src]
impl PartialEq<Uniform> for Uniform
[src]
impl Skewness<f64> for Uniform
[src]
impl StructuralPartialEq for Uniform
[src]
impl Univariate<f64, f64> for Uniform
[src]
fn cdf(&self, x: f64) -> f64
[src]
Calculates the cumulative distribution function for the uniform
distribution
at x
Formula
ⓘ
(x - min) / (max - min)
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,