pub struct Chi { /* private fields */ }Expand description
Chi Distribution
This struct represents the Chi distribution, which is a special case of the gamma distribution with a shape parameter equal to half the degrees of freedom. It is useful in various statistical applications, including hypothesis testing and confidence interval estimation.
§Example
let mut chi = rand_simple::Chi::new([1192_u32, 765_u32, 1543_u32, 2003_u32]);
// Verify the initial state
assert_eq!(format!("{chi}"), "χ(Degree of Freedom parameter) = χ(1)");
// Generate a random number from the Chi distribution with 1 degree of freedom
println!("Initial setting: Random number from Chi distribution with 1 degree of freedom -> {}", chi.sample());
// Change the degrees of freedom
let degree_of_freedom: u64 = 2_u64;
let result: Result<u64, &str> = chi.try_set_params(degree_of_freedom);
// Verify the new state
assert_eq!(format!("{chi}"), "χ(Degree of Freedom parameter) = χ(2)");
// Generate a random number from the Chi distribution with the updated degrees of freedom
println!("Updated setting: Random number from Chi distribution with {} degrees of freedom -> {}", degree_of_freedom, chi.sample());§Fields
xyzuv_u_gamma- State variable for gamma distribution random number generationxyzuv_n_0_gamma- State variable for gamma distribution random number generationxyzuv_n_1_gamma- State variable for gamma distribution random number generationxyzuv_uniform- State variable for uniform distribution random number generationdegree_of_freedom- Degrees of freedom, must be a positive integer
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Chi
impl RefUnwindSafe for Chi
impl Send for Chi
impl Sync for Chi
impl Unpin for Chi
impl UnwindSafe for Chi
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