Trait SampleRange

trait SampleRange<T>

Range that supports generating a single sample efficiently.

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

Required Methods

fn sample_single<R: RngCore + ?Sized>(self: Self, rng: &mut R) -> Result<T, Error>

Generate a sample from the given range.

fn is_empty(self: &Self) -> bool

Check whether the range is empty.

Implementors