Trait bones_framework::prelude::GenCore
pub trait GenCore: TurboCore {
const GEN_KIND: TurboKind;
Show 13 methods
// Required method
fn gen<const SIZE: usize>(&self) -> [u8; SIZE];
// Provided methods
fn gen_u128(&self) -> u128 { ... }
fn gen_i128(&self) -> i128 { ... }
fn gen_u64(&self) -> u64 { ... }
fn gen_i64(&self) -> i64 { ... }
fn gen_u32(&self) -> u32 { ... }
fn gen_i32(&self) -> i32 { ... }
fn gen_u16(&self) -> u16 { ... }
fn gen_i16(&self) -> i16 { ... }
fn gen_u8(&self) -> u8 { ... }
fn gen_i8(&self) -> i8 { ... }
fn gen_usize(&self) -> usize { ... }
fn gen_isize(&self) -> isize { ... }
}
Expand description
This trait provides the means to easily generate all integer types, provided
the main method underpinning this is implemented: GenCore::gen
.
Once implemented, the rest of the trait provides default
implementations for generating all integer types, though it is not
recommended to override these.
The underlying implementation of GenCore::gen
does not have to rely on
[TurboCore::fill_bytes
] if the PRNG implementation provides a means to
output directly an array of const size.
Required Associated Constants§
const GEN_KIND: TurboKind
const GEN_KIND: TurboKind
Determines the kind of PRNG. [TurboKind::FAST
] RNGs are meant to be very
quick, non-cryptographic PRNGs, while [TurboKind::SLOW
] are slower,
more expensive PRNGs, usually CSPRNGs but not always. Setting this constant
allows for certain algorithms to be toggled for tuning performance of certain
methods.