IntArbitrary
Rasuvaeff\PropertyTesting\Arbitrary\IntArbitrary
Class — Package: property-testing-core — Source — Version: v0.1.0-12-g86ead85
Implements: ArbitraryInterface
Generates integers within an inclusive range and shrinks them toward zero (clamped into the range, so the target of a zero-free range is its nearest bound).
Generation is biased: roughly one draw in Arbitrary\BIAS_DENOMINATOR returns an in-range boundary value (0, ±1, min, max) instead of a uniform one, because bugs cluster at edges.
The shrink tree halves the distance to the target: the target itself first, then candidates progressively closer to the failing value, each with its own subtree toward the same target — a binary search for the minimal failing integer.
Constructor
__construct(
int $min = PHP_INT_MIN,
int $max = PHP_INT_MAX,
)| Parameter | Type | Default | Description |
|---|---|---|---|
$min | int | PHP_INT_MIN | |
$max | int | PHP_INT_MAX |
Methods
generate()
generate(Random $random): ShrinkableProduce one random value from this arbitrary's space, together with its shrink tree. Candidates must be ordered most aggressive first (typically toward a zero/empty/identity element) and every branch of the tree must be finite, so shrinking terminates.
Documentation inherited from ArbitraryInterface.