Generates a value uniformly distributed over the provided range, which
is interpreted as inclusive in the lower and upper bound.
- uniformR (1 :: Int, 4 :: Int) generates values uniformly
from the set <math>
- uniformR (1 :: Float, 4 :: Float) generates values
uniformly from the set <math>
The following law should hold to make the function always defined:
uniformR (a, b) = uniformR (b, a)
This is a pure version of
uniformRM.
Examples
>>> import System.Random
>>> let pureGen = mkStdGen 137
>>> uniformR (1 :: Int, 4 :: Int) pureGen
(4,StdGen {unStdGen = SMGen 11285859549637045894 7641485672361121627})
You can use type applications to disambiguate the type of the
generated numbers:
>>> :seti -XTypeApplications
>>> uniformR @Int (1, 4) pureGen
(4,StdGen {unStdGen = SMGen 11285859549637045894 7641485672361121627})