Trait necsim_core::cogs::rng::RngSampler

source ·
pub trait RngSampler<M: MathsCore>: RngCore<M> {
    // Provided methods
    fn sample_uniform_closed_open(&mut self) -> ClosedOpenUnitF64 { ... }
    fn sample_uniform_open_closed(&mut self) -> OpenClosedUnitF64 { ... }
    fn sample_index(&mut self, length: NonZeroUsize) -> usize { ... }
    fn sample_index_u32(&mut self, length: NonZeroU32) -> u32 { ... }
    fn sample_index_u64(&mut self, length: NonZeroU64) -> u64 { ... }
    fn sample_index_u128(&mut self, length: NonZeroU128) -> u128 { ... }
    fn sample_exponential(&mut self, lambda: PositiveF64) -> NonNegativeF64 { ... }
    fn sample_event(&mut self, probability: ClosedUnitF64) -> bool { ... }
    fn sample_2d_standard_normal(&mut self) -> (f64, f64) { ... }
    fn sample_2d_normal(&mut self, mu: f64, sigma: NonNegativeF64) -> (f64, f64) { ... }
}

Provided Methods§

source

fn sample_uniform_closed_open(&mut self) -> ClosedOpenUnitF64

Samples a uniform sample within [0.0, 1.0), i.e. 0.0 <= X < 1.0

source

fn sample_uniform_open_closed(&mut self) -> OpenClosedUnitF64

Samples a uniform sample within (0.0, 1.0], i.e. 0.0 < X <= 1.0

source

fn sample_index(&mut self, length: NonZeroUsize) -> usize

§Contracts

Post-condition - debug: samples U(0, length - 1)

  • ret < length.get()
source

fn sample_index_u32(&mut self, length: NonZeroU32) -> u32

§Contracts

Post-condition - debug: samples U(0, length - 1)

  • ret < length.get()
source

fn sample_index_u64(&mut self, length: NonZeroU64) -> u64

§Contracts

Post-condition - debug: samples U(0, length - 1)

  • ret < length.get()
source

fn sample_index_u128(&mut self, length: NonZeroU128) -> u128

§Contracts

Post-condition - debug: samples U(0, length - 1)

  • ret < length.get()
source

fn sample_exponential(&mut self, lambda: PositiveF64) -> NonNegativeF64

source

fn sample_event(&mut self, probability: ClosedUnitF64) -> bool

source

fn sample_2d_standard_normal(&mut self) -> (f64, f64)

source

fn sample_2d_normal(&mut self, mu: f64, sigma: NonNegativeF64) -> (f64, f64)

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<M: MathsCore, R: RngCore<M>> RngSampler<M> for R