Distribution in std::random - Rust
Description: A trait representing a distribution of random values for a type.

## Distribution

# Trait Distribution

Source

    pub trait Distribution<T> {
        // Required method
        fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> T;
    }

🔬This is a nightly-only experimental API. (`random` #130703)
Expand description

A trait representing a distribution of random values for a type.

## Required Methods§

Source

#### fn sample(&self, source: &mut (impl RandomSource + ?Sized)) -> T

🔬This is a nightly-only experimental API. (`random` #130703)

Samples a random value from the distribution, using the specified random source.

## Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

## Implementors§

Source§

### impl Distribution<bool> for RangeFull

Source§

### impl Distribution<i8> for RangeFull

Source§

### impl Distribution<i16> for RangeFull

Source§

### impl Distribution<i32> for RangeFull

Source§

### impl Distribution<i64> for RangeFull

Source§

### impl Distribution<i128> for RangeFull

Source§

### impl Distribution<isize> for RangeFull

Source§

### impl Distribution<u8> for RangeFull

Source§

### impl Distribution<u16> for RangeFull

Source§

### impl Distribution<u32> for RangeFull

Source§

### impl Distribution<u64> for RangeFull

Source§

### impl Distribution<u128> for RangeFull

Source§

### impl Distribution<usize> for RangeFull

Source§

### impl<T, DT> Distribution<T> for &DT
where DT: Distribution<T>,