randomR package:MonadRandom

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 26

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

>>> fst $ randomR ('a', 'z') gen
'z'
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 26
('z',5.22694980853051)
In case when a lawful range is desired uniformR should be used instead.
A variant of randomRM that uses the global pseudo-random number generator globalStdGen
>>> randomRIO (2020, 2100) :: IO Int
2028
Similar to randomIO, this function is equivalent to getStdRandom randomR and is included in this interface for historical reasons and backwards compatibility. It is recommended to use uniformRM instead, possibly with the globalStdGen if relying on the global state is acceptable.
>>> import System.Random.Stateful

>>> uniformRM (2020, 2100) globalStdGen :: IO Int
2044
Plural variant of randomR, producing an infinite list of pseudo-random values instead of returning a new generator.
Takes a range (lo,hi) and a random number generator g, and returns a computation that returns a random value uniformly distributed in the closed interval [lo,hi], together with a new generator. It is unspecified what happens if lo>hi. 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. See randomR for details.
Plural variant of getRandomR, producing an infinite list of random values instead of returning a new generator. See randomRs for details.