Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
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] -> [a]
- generateSelectionFromBounded :: (RandomGen randomGen, Bounded a, Random a) => randomGen -> [a]
- select :: RandomGen randomGen => randomGen -> [a] -> 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; http://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] -> [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
.