Randomness¶
All draw methods are partial: they error during replay when the recorded choice sequence is exhausted or when a type/range mismatch is detected. In plain mode (user-constructed Randomness), draws never error.
Integer methods generate values in the closed interval [min, max].
Floating-point methods scale onto [min, max]; min is always reachable,
max is an approximate upper bound due to floating-point rounding.
Constructors¶
create¶
Parameters¶
Returns¶
- Randomness ref^
Public Functions¶
u8¶
Generate a U8 in closed interval [min, max].
Parameters¶
Returns¶
- U8 val ?
u16¶
Generate a U16 in closed interval [min, max].
Parameters¶
Returns¶
- U16 val ?
u32¶
Generate a U32 in closed interval [min, max].
Parameters¶
Returns¶
- U32 val ?
u64¶
Generate a U64 in closed interval [min, max].
Parameters¶
Returns¶
- U64 val ?
u128¶
Generate a U128 in closed interval [min, max].
Parameters¶
Returns¶
- U128 val ?
ulong¶
Generate a ULong in closed interval [min, max].
fun ref ulong(
min: ULong val = ULong.min_value(),
max: ULong val = ULong.max_value())
: ULong val ?
Parameters¶
Returns¶
- ULong val ?
usize¶
Generate a USize in closed interval [min, max].
fun ref usize(
min: USize val = USize.min_value(),
max: USize val = USize.max_value())
: USize val ?
Parameters¶
Returns¶
- USize val ?
i8¶
Generate an I8 in closed interval [min, max].
Parameters¶
Returns¶
- I8 val ?
i16¶
Generate an I16 in closed interval [min, max].
Parameters¶
Returns¶
- I16 val ?
i32¶
Generate an I32 in closed interval [min, max].
Parameters¶
Returns¶
- I32 val ?
i64¶
Generate an I64 in closed interval [min, max].
Parameters¶
Returns¶
- I64 val ?
i128¶
Generate an I128 in closed interval [min, max].
Parameters¶
Returns¶
- I128 val ?
ilong¶
Generate an ILong in closed interval [min, max].
fun ref ilong(
min: ILong val = ILong.min_value(),
max: ILong val = ILong.max_value())
: ILong val ?
Parameters¶
Returns¶
- ILong val ?
isize¶
Generate an ISize in closed interval [min, max].
fun ref isize(
min: ISize val = ISize.min_value(),
max: ISize val = ISize.max_value())
: ISize val ?
Parameters¶
Returns¶
- ISize val ?
f32¶
Generate an F32 in the range from min to max.
Parameters¶
Returns¶
- F32 val ?
f64¶
Generate an F64 in the range from min to max.
Parameters¶
Returns¶
- F64 val ?
bool¶
Generate a random Bool value.
Returns¶
- Bool val ?
forced_bool¶
Record a predetermined Bool. The shrinker will not attempt to change this choice. Use when the outcome is fixed by the generator's structure (e.g., elements below a collection minimum).
Parameters¶
- value: Bool val
Returns¶
- Bool val ?
shuffle[T: T]¶
Shuffle the array in place using Fisher-Yates, recording one integer choice per element as the swap index.
Parameters¶
- array: Array[T] ref
Returns¶
- None val ?
start_span¶
Mark the beginning of a structural span in the choice sequence. Spans let the shrinker understand generator structure — for example, which choices belong to a single collection element.
Parameters¶
- label: SpanLabel
Returns¶
- None val
end_span¶
Close the most recently opened span. If discard is true, the span
is marked as discarded (e.g., a filter rejection).
Errors if no span is open (mismatched start_span/end_span calls).
Parameters¶
- discard: Bool val = false
Returns¶
- None val ?