FloatArbitrary
Rasuvaeff\PropertyTesting\Arbitrary\FloatArbitrary
Class — Package: property-testing-core — Source — Version: v0.1.0-12-g86ead85
Implements: ArbitraryInterface
Generates floats in the half-open range [min, max).
Generation is biased: roughly one draw in Arbitrary\BIAS_DENOMINATOR returns an in-range boundary value (0.0 or min) instead of a uniform one, because bugs cluster at edges. The exclusive upper bound is never emitted.
Shrinking floats reliably is hard (no natural "smallest" value), so the shrink tree has a single candidate: zero, clamped into the configured range. For fine-grained shrinking on a numeric input, generate an integer and Gen::map() it to a float — with integrated shrinking the mapped value shrinks through the integer's tree.
Constructor
__construct(
float $min = 0.0,
float $max = 1.0,
)| Parameter | Type | Default | Description |
|---|---|---|---|
$min | float | 0.0 | |
$max | float | 1.0 |
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.