Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- smallRandomSubsetOfLargeIntegerRange :: (MonadRandom m, Random i, Integral i) => Natural -> Range i -> m (Set i)
- data Range i
- = RangeEmpty
- | RangeNonEmpty (NonEmptyRange i)
- data NonEmptyRange i = NonEmptyRange {
- inclusiveMinBound :: i
- offset :: Natural
- inclusiveRange :: Integral i => i -> i -> Range i
Documentation
smallRandomSubsetOfLargeIntegerRange Source #
Select a fixed number of items uniformly at random from a contiguous range of integers
This process accommodates selecting from a large range, but only has reasonable performance when the number of items being selected is small (it is quadratic in the number of items).
If the requested size is greater than or equal to the range, the entire range is returned.
e.g. smallRandomSubsetOfLargeIntegerRange 10 (inclusiveRange 30 70)
may produce something like fromList [32,34,45,54,56,58,62,63,64,65]
.
A possibly-empty contiguous range of integers
data NonEmptyRange i Source #
A nonempty contiguous range of integers
NonEmptyRange | |
|