pub struct Rng(/* private fields */);Expand description
(種, 番号) で決まる乱数列(SplitMix64)
Implementations§
Source§impl Rng
impl Rng
pub fn new(seed: u64, i: usize) -> Rng
pub fn next_u64(&mut self) -> u64
Sourcepub fn normal_fast(&mut self) -> f64
pub fn normal_fast(&mut self) -> f64
標準正規乱数(Ziggurat 法、Marsaglia–Tsang 2000 の 256 層。分布は厳密)。ほとんどの値は 64 ビットの乱数 1 つと
表の比較だけで決まり、Self::normal(Box–Muller)の数分の 1 の手間。検出器の露光(SensorNoise::expose)で使う
Source§impl Rng
impl Rng
Sourcepub fn poisson(&mut self, lam: f64) -> f64
pub fn poisson(&mut self, lam: f64) -> f64
Poisson 乱数(平均 30 未満は積の方法で厳密、以上は正規分布で近似して丸める)。平均が正でなければ 0
Sourcepub fn poisson_fast(&mut self, lam: f64) -> f64
pub fn poisson_fast(&mut self, lam: f64) -> f64
Self::poisson の正規近似(平均 30 以上)に Self::normal_fast を使う形
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Rng
impl RefUnwindSafe for Rng
impl Send for Rng
impl Sync for Rng
impl Unpin for Rng
impl UnsafeUnpin for Rng
impl UnwindSafe for Rng
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more