Fuzz module

Rng

structextensionexperimentalsince 0.26.0Source

A deterministic random source, plus the allocations made while filling values. Seed it with rng_seed and release a case's memory with case_end.

Example↗
r: Rng;
rng_seed(*r, 1);
roll := below(*r, 6);
assert(roll >= 0 && roll < 6);

Fields

state: u64
from_input: bool
With from_input, every choice is read from data instead of the seeded sequence, as a coverage-guided engine (libFuzzer) supplies it. Reads past the end give zero bytes, which select the first alternative (empty, zero, the first member).
data: *u8
size: s64
position: s64
max_len: s64
Upper bound for generated lengths; the minimizer lowers it to shrink a failing case.
pointers: bool
Pointers are filled with null or a fresh allocation only when the target allows it.
nullable: bool
With pointers, a pointer may also be null; for procedures that document accepting null.
live: [..] *void

See also