Struct rand_simple::Geometric
source · pub struct Geometric { /* private fields */ }Expand description
幾何分布
使用例
let geometric = rand_simple::Geometric::new(1192u32);
// 初期設定の場合、発生確率 0.5の事象が初めて生じた試行回数を返す
assert_eq!(geometric.sample(), 2u64);
// 確率変数のパラメータを変更する場合
let probability: f64 = 0.8f64;
let result: Result<f64, &str> = geometric.try_set_params(probability);
assert_eq!(geometric.sample(), 1u64);Implementations§
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Geometric
impl Send for Geometric
impl !Sync for Geometric
impl Unpin for Geometric
impl UnwindSafe for Geometric
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