pub enum Rng {
Os,
Seeded(SeededRng),
}Expand description
A random number generator that can be either OS-backed or seeded/deterministic.
Variants§
Os
Uses OS entropy via getrandom (non-deterministic).
Seeded(SeededRng)
Uses a seeded PRNG for deterministic output (e.g. testing).
Implementations§
Source§impl Rng
impl Rng
Sourcepub fn bytes_10(&self) -> [u8; 10]
pub fn bytes_10(&self) -> [u8; 10]
Generate 10 random bytes (suitable for UUID v7 random portion).
Sourcepub fn infra_bytes_10(&self) -> [u8; 10]
pub fn infra_bytes_10(&self) -> [u8; 10]
Generate 10 random bytes from the infrastructure RNG stream.
Uses a separate RNG stream so that infrastructure operations (like transaction ID generation) do not perturb the primary RNG state. This ensures deterministic test output regardless of how many internal transactions each test runner creates.
Sourcepub fn infra_bytes_32(&self) -> [u8; 32]
pub fn infra_bytes_32(&self) -> [u8; 32]
Generate 32 random bytes from the infrastructure RNG stream.
Uses a separate RNG stream for infrastructure operations (like session token generation) that should not affect deterministic test output.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Rng
impl RefUnwindSafe for Rng
impl Send for Rng
impl Sync for Rng
impl Unpin for Rng
impl UnsafeUnpin for Rng
impl UnwindSafe for Rng
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more