random-fu-0.3.0.0: Random number generation
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Random.Sample

Synopsis

Documentation

class Sampleable d m t where Source #

A typeclass allowing Distributions and RVars to be sampled. Both may also be sampled via runRVar or runRVarT, but I find it psychologically pleasing to be able to sample both using this function, as they are two separate abstractions for one base concept: a random variable.

Methods

sampleFrom :: StatefulGen g m => g -> d t -> m t Source #

Directly sample from a distribution or random variable, using the given source of entropy.

Instances

Instances details
Distribution d t => Sampleable d m t Source # 
Instance details

Defined in Data.Random.Sample

Methods

sampleFrom :: StatefulGen g m => g -> d t -> m t Source #

Lift m n => Sampleable (RVarT m) n t Source # 
Instance details

Defined in Data.Random.Sample

Methods

sampleFrom :: StatefulGen g n => g -> RVarT m t -> n t Source #

sample :: (Sampleable d m t, StatefulGen g m, MonadReader g m) => d t -> m t Source #

Sample a random variable using the default source of entropy for the monad in which the sampling occurs.

sampleState :: (Distribution d t, RandomGen g, MonadState g m) => d t -> m t Source #

Sample a random variable in a "functional" style. Typical instantiations of s are System.Random.StdGen or System.Random.Mersenne.Pure64.PureMT. sample :: (Distribution d a, StatefulGen g m, MonadReader g m) => d t -> m t sample thing gen = runStateGen gen (stateGen -> sampleFrom stateGen thing)

samplePure :: (Distribution d t, RandomGen g) => d t -> g -> (t, g) Source #

Sample a random variable in a "functional" style. Typical instantiations of g are System.Random.StdGen or System.Random.Mersenne.Pure64.PureMT.