Struct rand_simple::Bernoulli
source · pub struct Bernoulli { /* private fields */ }Expand description
ベルヌーイ分布
使用例
let mut bernoulli = rand_simple::Bernoulli::new(1192u32);
println!("発生確率 θ = 0.5 の事象が生じたか(1)、否か(0)の判定 -> {}", bernoulli.sample());
// 確率変数のパラメータを変更する場合
let probability: f64 = 0.8f64;
let result: Result<f64, &str> = bernoulli.try_set_params(probability);
println!("発生確率 θ = {} の事象が生じたか(1)、否か(0)の判定 -> {}", probability, bernoulli.sample());Implementations§
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Bernoulli
impl Send for Bernoulli
impl Sync for Bernoulli
impl Unpin for Bernoulli
impl UnwindSafe for Bernoulli
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