[][src]Trait rand::distributions::range::SampleRange

pub trait SampleRange {
    fn construct_range(low: Self, high: Self) -> Range<Self>;
fn sample_range<R>(r: &Range<Self>, rng: &mut R) -> Self
    where
        R: Rng
; }

The helper trait for types that have a sensible way to sample uniformly between two values. This should not be used directly, and is only to facilitate Range.

Required methods

fn construct_range(low: Self, high: Self) -> Range<Self>

Construct the Range object that sample_range requires. This should not ever be called directly, only via Range::new, which will check that low < high, so this function doesn't have to repeat the check.

fn sample_range<R>(r: &Range<Self>, rng: &mut R) -> Self where
    R: Rng

Sample a value from the given Range with the given Rng as a source of randomness.

Loading content...

Implementations on Foreign Types

impl SampleRange for u64
[src]

impl SampleRange for isize
[src]

impl SampleRange for i32
[src]

impl SampleRange for u32
[src]

impl SampleRange for u16
[src]

impl SampleRange for f64
[src]

impl SampleRange for u8
[src]

impl SampleRange for i64
[src]

impl SampleRange for f32
[src]

impl SampleRange for usize
[src]

impl SampleRange for i16
[src]

impl SampleRange for i8
[src]

Loading content...

Implementors

Loading content...