Skip to main content

Draw

Trait Draw 

Source
pub trait Draw {
    // Required method
    fn next_u64(&mut self) -> u64;

    // Provided methods
    fn below(&mut self, n: u64) -> u64 { ... }
    fn failure(&self) -> Option<String> { ... }
}
Expand description

A source of uniform draws. The recipe never asks for more than below.

Required Methods§

Source

fn next_u64(&mut self) -> u64

Provided Methods§

Source

fn below(&mut self, n: u64) -> u64

A uniform number in 0..n (rejection sampling, so no modulo bias). n must be above 0.

Source

fn failure(&self) -> Option<String>

An error the source met (an external device failing); generate returns it.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§