Struct sgx_rand::distributions::gamma::ChiSquared
source · [−]pub struct ChiSquared { /* private fields */ }
Expand description
The chi-squared distribution χ²(k)
, where k
is the degrees of
freedom.
For k > 0
integral, this distribution is the sum of the squares
of k
independent standard normal random variables. For other
k
, this uses the equivalent characterisation χ²(k) = Gamma(k/2, 2)
.
Example
use sgx_rand::distributions::{ChiSquared, IndependentSample};
let chi = ChiSquared::new(11.0);
let v = chi.ind_sample(&mut sgx_rand::thread_rng());
println!("{} is from a χ²(11) distribution", v)
Implementations
sourceimpl ChiSquared
impl ChiSquared
sourcepub fn new(k: f64) -> ChiSquared
pub fn new(k: f64) -> ChiSquared
Create a new chi-squared distribution with degrees-of-freedom
k
. Panics if k < 0
.
Trait Implementations
sourceimpl Clone for ChiSquared
impl Clone for ChiSquared
sourcefn clone(&self) -> ChiSquared
fn clone(&self) -> ChiSquared
Returns a copy of the value. Read more
1.0.0const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for ChiSquared
impl Debug for ChiSquared
sourceimpl IndependentSample<f64> for ChiSquared
impl IndependentSample<f64> for ChiSquared
sourcefn ind_sample<R: Rng>(&self, rng: &mut R) -> f64
fn ind_sample<R: Rng>(&self, rng: &mut R) -> f64
Generate a random value.
sourceimpl Sample<f64> for ChiSquared
impl Sample<f64> for ChiSquared
impl Copy for ChiSquared
Auto Trait Implementations
impl RefUnwindSafe for ChiSquared
impl Send for ChiSquared
impl Sync for ChiSquared
impl Unpin for ChiSquared
impl UnwindSafe for ChiSquared
Blanket Implementations
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstablefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> ToOwned for Twhere
T: Clone,
impl<T> ToOwned for Twhere
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
fn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. Read more