Pure functions for random number generation.
- data Seed
- seed :: [Word32] -> Seed
- class Bounded x => BoundedRandom x where
- class Ord x => UnitRandom x where
- class Ord x => RangeRandom x where
- random_list :: (Seed -> (x, Seed)) -> Int -> Seed -> ([x], Seed)
Create a new random seed value from the supplied list of
values. If the list is empty, return a default, hard-coded value.
Otherwise, every element of the list affects the result. The list
must be finite; the function will loop forever othewise.
Random number generation
Class of things that can be chosen at random over their entire value range. This requires that the range of possible values is actually limited.
Class of things that can be chosen at random over the interval from zero to one. This requires that "zero" and "one" are meaningful concepts for this type, and also that the type is ordered. (Also, there must be values between zero and one, which rules out integral types.)
Class of things that can be chosen at random over a specified interval. This requires that the type is ordered.
The value is chosen psuedo-randomly (the same
Seed will always
yield the same choice), with uniform distribution (all values
equally likely). The range is given by the first argument, which
specifies the lower and upper bounds (inclusive).