Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- Utilities related to random-numbers.
- randomGens :: RandomGen randomGen => randomGen -> [randomGen]
- shuffle :: RandomGen randomGen => randomGen -> [a] -> [a]
- generateSelection :: RandomGen randomGen => randomGen -> [a] -> Maybe [a]
- generateSelectionFromBounded :: (RandomGen randomGen, Bounded a, Random a) => randomGen -> [a]
- select :: (Foldable foldable, RandomGen randomGen) => randomGen -> foldable a -> Maybe a
Functions
randomGens :: RandomGen randomGen => randomGen -> [randomGen] Source #
Constructs an infinite list of independent random-generators.
shuffle :: RandomGen randomGen => randomGen -> [a] -> [a] Source #
- Shuffles the specified finite list, using the Fisher-Yates algorithm; https://en.wikipedia.org/wiki/Fisher-Yates_shuffle.
- The resulting list has the same length and constituents as the original; only the order has changed.
- The input list is traversed, but the items aren't evaluated.
generateSelection :: RandomGen randomGen => randomGen -> [a] -> Maybe [a] Source #
- Generate an infinite list of items, each independently randomly selected from the specified finite list.
- CAVEAT: because the selections are made non-destructively, duplicates may be returned; cf.
shuffle
.