Range
Module Hedgehog.Range
Ranges describe the bounds of numbers to generate, which may or may not be dependent on a size parameter.
The size is an integer from 0 to 99 inclusive. As the size goes towards 0, generated values shrink towards the origin.
type 'a t = { origin : 'a; bounds : int -> 'a * 'a;}val origin : 'a t -> 'aGet the origin of a range. When shrinking, values shrink towards the origin.
val bounds : int -> 'a t -> 'a * 'aGet the bounds of a range for a given size.
val lower_bound : int -> int t -> intGet the lower bound of a range for the given size.
val upper_bound : int -> int t -> intGet the upper bound of a range for the given size.
Constant
val singleton : 'a -> 'a tA range representing a single constant value.
val constant : int -> int -> int tA constant range unaffected by size parameter. Origin is the first argument.
val constant_from : int -> int -> int -> int tconstant_from origin lo hi creates a constant range from lo to hi with the given origin.
Linear
val linear : int -> int -> int tA range which scales the bounds linearly with the size parameter. Origin is the first argument.
val linear_from : int -> int -> int -> int tlinear_from origin lo hi creates a linear range from lo to hi with the given origin.
val linear_frac : float -> float -> float tLike linear, but for fractional values.
val linear_frac_from : float -> float -> float -> float tLike linear_from, but for fractional values.
Int32
val constant_int32 : int32 -> int32 -> int32 tA constant range for int32 values, unaffected by size parameter.
val linear_int32 : int32 -> int32 -> int32 tA linear range for int32 values that scales with the size parameter.
Int64
val constant_int64 : int64 -> int64 -> int64 tA constant range for int64 values, unaffected by size parameter.
val linear_int64 : int64 -> int64 -> int64 tA linear range for int64 values that scales with the size parameter.
Exponential
val exponential : int -> int -> int tA range which scales the bounds exponentially with the size parameter.
val exponential_from : int -> int -> int -> int texponential_from origin lo hi creates an exponential range.
val exponential_float : float -> float -> float tLike exponential, but for floating-point values.
val exponential_float_from : float -> float -> float -> float tLike exponential_from, but for floating-point values.
Internal
val clamp : 'a -> 'a -> 'a -> 'aval scale_linear : int -> int -> int -> intval scale_linear_frac : int -> float -> float -> floatval scale_exponential : int -> int -> int -> intval scale_exponential_float : int -> float -> float -> float