Wrap raw fuzzer bytes in a fresh decoder state.
Arbitrary
:= [Unstructured(List(U8))]
Advanced deterministic decoding of raw fuzzer bytes.
Most application targets should use the typed generators in Fuzz instead.
This module is exposed for custom generators and for maintaining legacy
byte-oriented quality targets.
Entropy is consumed from the end when selecting sizes so coverage-guided mutations can change value bytes without also moving their boundaries.
Return every byte that has not yet been consumed.
Return the number of unconsumed bytes.
Report whether all input bytes have been consumed.
Consume exactly requested_len bytes from the front of the input.
NotEnoughData(available) reports how many bytes remained when the request
could not be satisfied.
u64_in_inclusive_range : Arbitrary, U64, U64 -> { value : U64, state : Arbitrary }
Decode a U64 in the inclusive range from start through end.
Range-selection bytes are consumed from the end of the input. Exhausted
input deterministically selects the start of the range. This function
crashes if start is greater than end.
Choose True approximately numerator / denominator of the time.
denominator must be greater than zero and numerator must not exceed it.
arbitrary_byte_size : Arbitrary -> { value : U64, state : Arbitrary }
Choose a byte length that fits in the remaining input.
This is the internal length decoder used by list and string generation.
next_power_of_two : U64 -> U64
Return the next power of two above n, capped at 2^63.
This helper models allocation capacities and does not consume fuzzer input.
arbitrary_list_u8 : Arbitrary -> { value : List(U8), state : Arbitrary }
Decode a byte list while varying its length, capacity, and slice shape.
The varied allocation shapes help exercise Roc's copy-on-write collection implementations, not just operations on list contents.
arbitrary_str : Arbitrary -> { value : Str, state : Arbitrary }
Decode a valid UTF-8 string while varying its length and capacity.
If the chosen bytes contain invalid UTF-8, the valid prefix becomes the generated string and the remaining state starts at the invalid byte.