pub trait BlockRngCore {
    type Item;
    type Results: AsRef<[Self::Item]> + AsMut<[Self::Item]> + Default;

    // Required method
    fn generate(&mut self, results: &mut Self::Results);
}
Expand description

A trait for RNGs which do not generate random numbers individually, but in blocks (typically [u32; N]). This technique is commonly used by cryptographic RNGs to improve performance.

See the module documentation for details.

Required Associated Types§

source

type Item

Results element type, e.g. u32.

source

type Results: AsRef<[Self::Item]> + AsMut<[Self::Item]> + Default

Results type. This is the ‘block’ an RNG implementing BlockRngCore generates, which will usually be an array like [u32; 16].

Required Methods§

source

fn generate(&mut self, results: &mut Self::Results)

Generate a new block of results.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl BlockRngCore for ChaCha8Core

§

type Item = u32

§

type Results = Array64<u32>

source§

fn generate(&mut self, r: &mut <ChaCha8Core as BlockRngCore>::Results)

source§

impl BlockRngCore for ChaCha12Core

§

type Item = u32

§

type Results = Array64<u32>

source§

fn generate(&mut self, r: &mut <ChaCha12Core as BlockRngCore>::Results)

source§

impl BlockRngCore for ChaCha20Core

§

type Item = u32

§

type Results = Array64<u32>

source§

fn generate(&mut self, r: &mut <ChaCha20Core as BlockRngCore>::Results)

Implementors§