mixed-types-num-0.5.11: Alternative Prelude with numeric and logic expressions typed bottom-up
Copyright(c) Michal Konecny
LicenseBSD3
Maintainermikkonecny@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

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.