random-fu-0.0.3.2: Random number generation

Data.Random.Source

Synopsis

Documentation

class Monad m => MonadRandom m whereSource

A typeclass for monads with a chosen source of entropy. For example, RVar is such a monad - the source from which it is (eventually) sampled is the only source from which a random variable is permitted to draw, so when directly requesting entropy for a random variable these functions are used.

The minimal definition is either getRandomByte or getRandomWord. getRandomDouble is defaulted in terms of getRandomWord.

Methods

getRandomByte :: m Word8Source

Get a random uniformly-distributed byte.

getRandomWord :: m Word64Source

Get a random Word64 uniformly-distributed over the full range of the type.

getRandomDouble :: m DoubleSource

Get a random Double uniformly-distributed over the interval [0,1)

class Monad m => RandomSource m s whereSource

A source of entropy which can be used in the given monad.

The minimal definition is either getRandomByteFrom or getRandomWordFrom. getRandomDoubleFrom is defaulted in terms of getRandomWordFrom

Methods

getRandomByteFrom :: s -> m Word8Source

Get a random uniformly-distributed byte.

getRandomWordFrom :: s -> m Word64Source

Get a random Word64 uniformly-distributed over the full range of the type.

getRandomDoubleFrom :: s -> m DoubleSource

Get a random Double uniformly-distributed over the interval [0,1)