random package:Yampa

The same as randomR, but using a default range determined by the type:
  • For bounded types (instances of Bounded, such as Char), the range is normally the whole type.
  • For floating point types, the range is normally the closed interval [0,1].
  • For Integer, the range is (arbitrarily) the range of Int.
The class of types for which random values can be generated. Most instances of Random will produce values that are uniformly distributed on the full range, but for those types without a well-defined "full range" some sensible default subrange will be selected. Random exists primarily for backwards compatibility with version 1.1 of this library. In new code, use the better specified Uniform and UniformRange instead.
Signals and signal functions with noise and randomness. The Random number generators are re-exported from System.Random.
Takes a range (lo,hi) and a pseudo-random number generator g, and returns a pseudo-random value uniformly distributed over the closed interval [lo,hi], together with a new generator. It is unspecified what happens if lo>hi, but usually the values will simply get swapped.
>>> let gen = mkStdGen 2021

>>> fst $ randomR ('a', 'z') gen
't'

>>> fst $ randomR ('z', 'a') gen
't'
For continuous types there is no requirement that the values lo and hi are ever produced, but they may be, depending on the implementation and the interval. There is no requirement to follow the Ord instance and the concept of range can be defined on per type basis. For example product types will treat their values independently:
>>> fst $ randomR (('a', 5.0), ('z', 10.0)) $ mkStdGen 2021
('t',6.240232662366563)
In case when a lawful range is desired uniformR should be used instead.
Plural variant of randomR, producing an infinite list of pseudo-random values instead of returning a new generator.
Plural variant of random, producing an infinite list of pseudo-random values instead of returning a new generator.
RandomGen is an interface to pure pseudo-random number generators. StdGen is the standard RandomGen instance provided by this library.