pub struct Uniform { /* private fields */ }Expand description
Uniform distribution
§Example
let mut uniform = rand_simple::Uniform::new(1192_u32);
assert_eq!(format!("{uniform}"), "Range (Closed Interval): [0, 1]");
println!("Returns a random number -> {}", uniform.sample());
// When changing the parameters of the random variable
let min: f64 = -1_f64;
let max: f64 = 1_f64;
let result: Result<(f64, f64), &str> = uniform.try_set_params(min, max);
assert_eq!(format!("{uniform}"), "Range (Closed Interval): [-1, 1]");
println!("Returns a random number -> {}", uniform.sample());Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Uniform
impl RefUnwindSafe for Uniform
impl Send for Uniform
impl Sync for Uniform
impl Unpin for Uniform
impl UnwindSafe for Uniform
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