# SampleUniform in rand::distributions::uniform - Rust
Helper trait for creating objects using the correct implementation of [`UniformSampler`] for the sampling type.
Keywords: rust, rustlang, rust-lang, SampleUniform

# Trait rand::distributions::uniform::SampleUniform

source · [−]

    pub trait SampleUniform: Sized {
        type Sampler: UniformSampler<X = Self>;
    }

Expand description

Helper trait for creating objects using the correct implementation of `UniformSampler` for the sampling type.

See the module documentation on how to implement `Uniform` range sampling for a custom type.

## Required Associated Types

source

#### type Sampler: UniformSampler<X = Self>

The `UniformSampler` implementation supporting type `X`.

## Implementations on Foreign Types

source

### impl SampleUniform for i8

#### type Sampler = UniformInt<i8>

source

### impl SampleUniform for i16

#### type Sampler = UniformInt<i16>

source

### impl SampleUniform for i32

#### type Sampler = UniformInt<i32>

source

### impl SampleUniform for i64

#### type Sampler = UniformInt<i64>

source

### impl SampleUniform for i128

#### type Sampler = UniformInt<i128>

source

### impl SampleUniform for isize

#### type Sampler = UniformInt<isize>

source

### impl SampleUniform for u8

#### type Sampler = UniformInt<u8>

source

### impl SampleUniform for u16

#### type Sampler = UniformInt<u16>

source

### impl SampleUniform for u32

#### type Sampler = UniformInt<u32>

source

### impl SampleUniform for u64

#### type Sampler = UniformInt<u64>

source

### impl SampleUniform for usize

#### type Sampler = UniformInt<usize>

source

### impl SampleUniform for u128

#### type Sampler = UniformInt<u128>

source

### impl SampleUniform for char

#### type Sampler = UniformChar

source

### impl SampleUniform for f32

#### type Sampler = UniformFloat<f32>

source

### impl SampleUniform for f64

#### type Sampler = UniformFloat<f64>

source

### impl SampleUniform for Duration

#### type Sampler = UniformDuration

## Implementors