[−][src]Struct rv::dist::DiscreteUniform
Discrete uniform distribution, U(a, b) on the interval x in [a, b]
Methods
impl<T: DuParam> DiscreteUniform<T>
[src]
pub fn new(a: T, b: T) -> Result<Self>
[src]
pub fn new_unchecked(a: T, b: T) -> Self
[src]
Creates a new DiscreteUniform without checking whether the parameters are valid.
pub fn a(&self) -> T
[src]
Get lower bound parameter, a
Example
let du = DiscreteUniform::new(1_u8, 22_u8).unwrap(); assert_eq!(du.a(), 1);
pub fn b(&self) -> T
[src]
Get upper bound parameter, a
Example
let du = DiscreteUniform::new(1_u8, 22_u8).unwrap(); assert_eq!(du.b(), 22);
Trait Implementations
impl<X, T> Rv<X> for DiscreteUniform<T> where
T: DuParam + SampleUniform + Copy,
X: Integer + From<T>,
[src]
T: DuParam + SampleUniform + Copy,
X: Integer + From<T>,
fn ln_f(&self, x: &X) -> f64
[src]
fn draw<R: Rng>(&self, rng: &mut R) -> X
[src]
fn sample<R: Rng>(&self, n: usize, rng: &mut R) -> Vec<X>
[src]
fn f(&self, x: &X) -> f64
[src]
impl<X, T> Support<X> for DiscreteUniform<T> where
X: Integer + From<T>,
T: DuParam,
[src]
X: Integer + From<T>,
T: DuParam,
impl<X, T> Cdf<X> for DiscreteUniform<T> where
X: Integer + From<T> + ToPrimitive + Copy,
T: DuParam + SampleUniform + ToPrimitive,
[src]
X: Integer + From<T> + ToPrimitive + Copy,
T: DuParam + SampleUniform + ToPrimitive,
impl<X, T> InverseCdf<X> for DiscreteUniform<T> where
X: Integer + From<T> + FromPrimitive,
T: DuParam + SampleUniform + ToPrimitive,
[src]
X: Integer + From<T> + FromPrimitive,
T: DuParam + SampleUniform + ToPrimitive,
fn invcdf(&self, p: f64) -> X
[src]
fn quantile(&self, p: f64) -> X
[src]
fn interval(&self, p: f64) -> (X, X)
[src]
impl<X, T> DiscreteDistr<X> for DiscreteUniform<T> where
X: Integer + From<T>,
T: DuParam + SampleUniform + Into<f64>,
[src]
X: Integer + From<T>,
T: DuParam + SampleUniform + Into<f64>,
impl<T> Mean<f64> for DiscreteUniform<T> where
T: DuParam + SampleUniform + Into<f64>,
[src]
T: DuParam + SampleUniform + Into<f64>,
impl<T> Median<f64> for DiscreteUniform<T> where
T: DuParam + SampleUniform + Into<f64>,
[src]
T: DuParam + SampleUniform + Into<f64>,
impl<T> Variance<f64> for DiscreteUniform<T> where
T: DuParam + SampleUniform + Into<f64>,
[src]
T: DuParam + SampleUniform + Into<f64>,
impl<T> Entropy for DiscreteUniform<T> where
T: DuParam + Into<f64>,
[src]
T: DuParam + Into<f64>,
impl<T: DuParam> Skewness for DiscreteUniform<T>
[src]
impl<T: DuParam> Kurtosis for DiscreteUniform<T>
[src]
impl<'_, T> From<&'_ DiscreteUniform<T>> for String where
T: DuParam + Display,
[src]
T: DuParam + Display,
fn from(u: &DiscreteUniform<T>) -> String
[src]
impl<T: Clone + DuParam> Clone for DiscreteUniform<T>
[src]
fn clone(&self) -> DiscreteUniform<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Eq + DuParam> Eq for DiscreteUniform<T>
[src]
impl<T: Ord + DuParam> Ord for DiscreteUniform<T>
[src]
fn cmp(&self, other: &DiscreteUniform<T>) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<T: PartialEq + DuParam> PartialEq<DiscreteUniform<T>> for DiscreteUniform<T>
[src]
fn eq(&self, other: &DiscreteUniform<T>) -> bool
[src]
fn ne(&self, other: &DiscreteUniform<T>) -> bool
[src]
impl<T: PartialOrd + DuParam> PartialOrd<DiscreteUniform<T>> for DiscreteUniform<T>
[src]
fn partial_cmp(&self, other: &DiscreteUniform<T>) -> Option<Ordering>
[src]
fn lt(&self, other: &DiscreteUniform<T>) -> bool
[src]
fn le(&self, other: &DiscreteUniform<T>) -> bool
[src]
fn gt(&self, other: &DiscreteUniform<T>) -> bool
[src]
fn ge(&self, other: &DiscreteUniform<T>) -> bool
[src]
impl<T> Display for DiscreteUniform<T> where
T: DuParam + Display,
[src]
T: DuParam + Display,
impl<T: Debug + DuParam> Debug for DiscreteUniform<T>
[src]
impl<T: Hash + DuParam> Hash for DiscreteUniform<T>
[src]
Auto Trait Implementations
impl<T> Send for DiscreteUniform<T> where
T: Send,
T: Send,
impl<T> Sync for DiscreteUniform<T> where
T: Sync,
T: Sync,
impl<T> Unpin for DiscreteUniform<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for DiscreteUniform<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> RefUnwindSafe for DiscreteUniform<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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.
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn is_in_subset(&self) -> bool
unsafe fn to_subset_unchecked(&self) -> SS
fn from_subset(element: &SS) -> SP
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,