Struct rand_simple::Uniform
source · pub struct Uniform { /* private fields */ }Expand description
一様乱数
使用例
let uniform = rand_simple::Uniform::new(1192u32);
// 初期設定の場合、閉区間[0, 1]の一様乱数に従う乱数を返す
assert_eq!(uniform.sample(), 0.8512317447111084f64);
// 確率変数のパラメータを変更する場合
let min: f64 = -1f64;
let max: f64 = 1f64;
let result: Result<(f64, f64), &str> = uniform.try_set_params(min, max);
assert_eq!(uniform.sample(), -0.7648924006533093f64);Implementations§
Trait Implementations§
Auto Trait Implementations§
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