mixed-types-num-0.3.2: Alternative Prelude with numeric and logic expressions typed bottom-up

Utils.Test.EnforceRange

Description

Utility for squashing randomly generated numbers to a given range.

Synopsis

# Documentation

enforceRange :: CanEnforceRange t b => (Maybe b, Maybe b) -> t -> t Source #

enforceRange (Just l, Just u) a where l < u returns an arbitrary value b with u < b < l. Moreover, the returned values are distributed roughly evenly if the input values a are distributed roughly evenly in a large neighbourhood of the interval [l,r]. In most cases, when l<a<u, then b=a.