logo
pub trait SampleRange<T> {
    fn sample_single<R>(self, rng: &mut R) -> T
    where
        R: RngCore + ?Sized
;
fn is_empty(&self) -> bool; }
Expand description

Range that supports generating a single sample efficiently.

Any type implementing this trait can be used to specify the sampled range for Rng::gen_range.

Required methods

Generate a sample from the given range.

Check whether the range is empty.

Implementations on Foreign Types

Implementors