Open mcandre opened 12 years ago
Data.Random.Source.IO declares a "MonadRandom" instance for IO, which means that random variables can be sampled using the "sample" function.
For example:
sample (uniform 0 10) :: IO Int
Should "just work". If you need to reference it as a concrete "source", you can use the special value StdRandom
, as in:
sampleFrom StdRandom (uniform 0 10) :: IO Int
StdRandom is a pseudo-source that refers to the default source of randomness for the monad in which it is used.
Sorry to take so long to reply. I've been mostly offline for a few months.
I want my code to be platform-agnostic, but I can't find example code using Data.Random.Source.IO anywhere in the documentation.