Crate rng_buffer

Source

Structs§

DefaultableArray
Wrapper around an array, that implements Default by copying the default element.
RngBufferCore
Wrapper around an RngCore that fills an 8*[N]-byte buffer at a time in order to make fewer system calls.
RngBufferWrapper
Wraps an RngBufferCore using a BlockRng64. Also wraps it in an Rc and RefCell so that the buffer will be shared with all clones of the instance in the same thread. (This buffer isn’t meant to be shared between threads, because benchmarks indicate that the overhead cost of communication between threads is usually larger than that of the system call that an OsRng makes.)
RngWrapper
Wraps an RNG in an Rc and RefCell so that it can be shared (within the same thread) across structs that expect to own one.

Functions§

build_default_rng
Creates an instance of DefaultRng that uses the given seed source.
build_default_seeder
Creates an instance of DefaultSeedSourceRng that doesn’t share state with any other instance.
thread_rng
Obtains this thread’s default DefaultRng, which is identical to rand::thread_rng except that it uses thread_seed_source rather than directly invoking OsRng to reseed itself.
thread_seed_source
Obtains the default DefaultSeedSourceRng for this thread.

Type Aliases§

DefaultRng
A drop-in replacement for [rand::ThreadRng] that behaves identically, except that it uses an RngBufferCore to wrap the OsRng that it uses to reseed itself.
DefaultSeedSourceRng
A wrapper around OsRng that uses an RngBufferCore with a reasonable default buffer size.