aivika-transformers-3.0: Transformers for the Aivika simulation library

CopyrightCopyright (c) 2009-2014, David Sorokin <david.sorokin@gmail.com>
LicenseBSD3
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Simulation.Aivika.Trans.Generator

Description

Tested with: GHC 7.8.3

Below is defined a random number generator.

Synopsis

Documentation

class (Functor m, Monad m) => GeneratorMonad m where Source

Defines a monad whithin which computation the random number generator can work.

Associated Types

data Generator m :: * Source

Defines a random number generator.

Methods

generateUniform :: Generator m -> Double -> Double -> m Double Source

Generate an uniform random number with the specified minimum and maximum.

generateUniformInt :: Generator m -> Int -> Int -> m Int Source

Generate an uniform integer random number with the specified minimum and maximum.

generateNormal :: Generator m -> Double -> Double -> m Double Source

Generate a normal random number with the specified mean and deviation.

generateExponential :: Generator m -> Double -> m Double Source

Generate a random number distributed exponentially with the specified mean (the reciprocal of the rate).

generateErlang :: Generator m -> Double -> Int -> m Double Source

Generate the Erlang random number with the specified scale (the reciprocal of the rate) and integer shape.

generatePoisson :: Generator m -> Double -> m Int Source

Generate the Poisson random number with the specified mean.

generateBinomial :: Generator m -> Double -> Int -> m Int Source

Generate the binomial random number with the specified probability and number of trials.

newGenerator :: Session m -> GeneratorType m -> m (Generator m) Source

Create a new random number generator by the specified type with current session.

newRandomGenerator :: RandomGen g => Session m -> g -> m (Generator m) Source

Create a new random generator by the specified standard generator within current session.

newRandomGenerator01 :: Session m -> m Double -> m (Generator m) Source

Create a new random generator by the specified uniform generator of numbers from 0 to 1 within current session.

Instances

data GeneratorType m Source

Defines a type of the random number generator.

Constructors

SimpleGenerator

The simple random number generator.

SimpleGeneratorWithSeed Int

The simple random number generator with the specified seed.

CustomGenerator (m (Generator m))

The custom random number generator.

CustomGenerator01 (m Double)

The custom random number generator by the specified uniform generator of numbers from 0 to 1.