Expand description
BLAKE3-keyed PRNG with split() determinism — Lemire unbiased range +
Fisher-Yates shuffle. Shell-side use (kernel/runtime forbids RNG for
deterministic replay).
§Layer scope
arkhe-rand is an L3 Library tier crate per the ArkheForge layer
model (L0 Kernel / L1 Runtime Primitives / L2 Runtime Services /
L3 Library / L4-L6 Shell). The kernel and forge runtime forbid RNG
entirely to preserve deterministic WAL replay; this crate is consumed
only by shell-side code (BBS, examples, downstream applications).
§Cryptographic core
Each RngSource wraps a BLAKE3 XOF stream constructed via the KDF
mode Hasher::new_derive_key("arkhe-rand stream v0.13").update(seed).
The context string eliminates cross-domain seed collisions; the
v0.13 tag is permanent under the project’s single-version pin so
patch releases (0.13.x) preserve wire stability for stored seeds.
XOF reader monotonic property is inherited from the blake3 crate
spec (audited via supply-chain/audits.toml [[audits.blake3]]).
§API
RngSource::from_seed/RngSource::from_os_entropy/RngSource::split/RngSource::fill_bytesgen_range/gen_range_inclusive(Lemirenearlydivisionless)shuffle(Fisher-Yates, in-place)
§Cross-platform determinism
Byte-to-integer conversions use explicit little-endian
(u32::from_le_bytes / u64::from_le_bytes) regardless of host
endianness, so x86_64 / aarch64 / wasm32 produce byte-identical
streams from the same seed. CI enforces this via the golden-vector
cross-compile comparison plus a repository self-grep that forbids
native-endian conversion helpers in the source tree.
Structs§
- RngSource
- BLAKE3-keyed PRNG.
Enums§
- RngError
- Error returned by
RngSource::from_os_entropy.
Traits§
- RandInt
- Integer types accepted by
gen_range/gen_range_inclusive.
Functions§
- gen_
range - Sample a uniformly-random value from
range∈[start, end). - gen_
range_ inclusive - Sample a uniformly-random value from
range∈[start, end]. - shuffle
- In-place Fisher-Yates shuffle.