Expand description
Xorshift32 PRNG helpers shared by RTOS platform crates that lack a hardware RNG.
The state is owned by the caller (typically a static mut inside the
platform crate), so multiple platforms can share these helpers without
the API crate carrying mutable state.
Quality is sufficient for zenoh session-ID seeding — not for
cryptography. Pair with hardware entropy at boot (clock, MAC address,
ADC noise) via seed().
Constants§
- DEFAULT_
SEED - Default seed used when entropy is unavailable. Xorshift cannot escape
an all-zero state, so callers that pass
0toseedfall back to this value.
Functions§
- next⚠
- Advance
stateby one step and return the new value. - random_
fill ⚠ - Fill
buf[..len]with bytes derived from xorshift32 output. No-op ifbufis null. - seed⚠
- Replace
statewithvalue, falling back toDEFAULT_SEEDifvalue == 0. - step
- One xorshift32 step. Pure function — caller manages the state cell.