#[non_exhaustive]pub enum RngBackend {
Xoshiro256PlusPlus(Xoshiro256PlusPlus),
MersenneTwister(Box<MersenneTwister>),
Pcg32(Pcg32),
Pcg64(Pcg64),
ChaCha20(Box<ChaChaRng>),
}Expand description
Available backends for Random.
Xoshiro is inline (no allocation) so it works on pure no_std. MT is
only available with the alloc feature because its 2496-byte state is
stored on the heap to keep the enum size small.
§Examples
use vrd::RngBackend;
use vrd::xoshiro::Xoshiro256PlusPlus;
let backend = RngBackend::Xoshiro256PlusPlus(Xoshiro256PlusPlus::from_u64_seed(42));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Xoshiro256PlusPlus(Xoshiro256PlusPlus)
Xoshiro256++ - fast, small-state, statistically strong.
Default backend produced by Random::new.
§Examples
use vrd::{Random, RngBackend};
let rng = Random::from_u64_seed(1);
assert!(matches!(rng.backend(), RngBackend::Xoshiro256PlusPlus(_)));MersenneTwister(Box<MersenneTwister>)
Mersenne Twister (MT19937) - for callers needing legacy
reproducibility. Requires the alloc feature; produced by
Random::new_mersenne_twister_with_seed.
§Examples
use vrd::{Random, RngBackend};
let rng = Random::new_mersenne_twister_with_seed(1);
assert!(matches!(rng.backend(), RngBackend::MersenneTwister(_)));Pcg32(Pcg32)
PCG-XSH-RR-64/32 - 16-byte state, 32-bit output. Available
under the pcg feature.
Pcg64(Pcg64)
PCG-XSL-RR-128/64 - 32-byte state, 64-bit output. Available
under the pcg feature.
ChaCha20(Box<ChaChaRng>)
ChaCha20 CSPRNG - crypto-quality output. Produced by
Random::new_secure / Random::from_secure_seed.
Available under the crypto feature.
Trait Implementations§
Source§impl Clone for RngBackend
impl Clone for RngBackend
Source§fn clone(&self) -> RngBackend
fn clone(&self) -> RngBackend
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more