pub struct Uniform<T> { /* private fields */ }Expand description
Continuous uniform distribution on [a, b].
§Example
use numeris::stats::{Uniform, ContinuousDistribution};
let u = Uniform::new(0.0_f64, 1.0).unwrap();
assert!((u.pdf(0.5) - 1.0).abs() < 1e-14);
assert!((u.cdf(0.5) - 0.5).abs() < 1e-14);Implementations§
Source§impl<T: FloatScalar> Uniform<T>
impl<T: FloatScalar> Uniform<T>
Sourcepub fn new(a: T, b: T) -> Result<Self, StatsError>
pub fn new(a: T, b: T) -> Result<Self, StatsError>
Create a uniform distribution on [a, b]. Requires a < b.
Trait Implementations§
Source§impl<T: FloatScalar> ContinuousDistribution<T> for Uniform<T>
impl<T: FloatScalar> ContinuousDistribution<T> for Uniform<T>
impl<T: Copy> Copy for Uniform<T>
Auto Trait Implementations§
impl<T> Freeze for Uniform<T>where
T: Freeze,
impl<T> RefUnwindSafe for Uniform<T>where
T: RefUnwindSafe,
impl<T> Send for Uniform<T>where
T: Send,
impl<T> Sync for Uniform<T>where
T: Sync,
impl<T> Unpin for Uniform<T>where
T: Unpin,
impl<T> UnsafeUnpin for Uniform<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Uniform<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more