aivika-transformers-6.1.1: Transformers for the Aivika simulation library
CopyrightCopyright (c) 2009-2017 David Sorokin <david.sorokin@gmail.com>
LicenseBSD3
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Simulation.Aivika.Trans.Generator.Primitive

Description

Tested with: GHC 8.0.1

This helper module defines primitives for generating random numbers.

Synopsis

Documentation

generateUniform01 Source #

Arguments

:: Monad m 
=> m Double

the uniform random number ~ U (0, 1)

-> Double

minimum

-> Double

maximum

-> m Double 

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

generateUniformInt01 Source #

Arguments

:: Monad m 
=> m Double

the uniform random number ~ U (0, 1)

-> Int

minimum

-> Int

maximum

-> m Int 

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

generateTriangular01 Source #

Arguments

:: Monad m 
=> m Double

the uniform random number ~ U (0, 1)

-> Double

minimum

-> Double

median

-> Double

maximum

-> m Double 

Generate the triangular random number by the specified minimum, median and maximum.

generateNormal01 Source #

Arguments

:: Monad m 
=> m Double

the normal random number ~ N (0, 1)

-> Double

mean

-> Double

variance

-> m Double 

Generate a normal random number by the specified generator, mean and variance.

generateLogNormal01 Source #

Arguments

:: Monad m 
=> m Double

the normal random number ~ N (0, 1)

-> Double

mean

-> Double

variance

-> m Double 

Generate the lognormal random number derived from a normal distribution with the specified generator, mean and variance.

generateExponential01 Source #

Arguments

:: Monad m 
=> m Double

the uniform random number ~ U (0, 1)

-> Double

the mean

-> m Double 

Return the exponential random number with the specified mean.

generateErlang01 Source #

Arguments

:: Monad m 
=> m Double

the uniform random number ~ U (0, 1)

-> Double

the scale

-> Int

the shape

-> m Double 

Return the Erlang random number.

generatePoisson01 Source #

Arguments

:: Monad m 
=> m Double

the uniform random number ~ U (0, 1)

-> Double

the mean

-> m Int 

Generate the Poisson random number with the specified mean.

generateBinomial01 Source #

Arguments

:: Monad m 
=> m Double

the uniform random number ~ U (0, 1)

-> Double

the probability

-> Int

the number of trials

-> m Int 

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

generateGamma01 Source #

Arguments

:: Monad m 
=> m Double

the normal random number ~ N (0,1)

-> m Double

the uniform random number ~ U (0, 1)

-> Double

the shape parameter (kappa)

-> Double

the scale parameter (theta)

-> m Double 

Generate a random number from the Gamma distribution using Marsaglia and Tsang method.

generateBeta01 Source #

Arguments

:: Monad m 
=> m Double

the normal random number ~ N (0, 1)

-> m Double

the uniform random number ~ U (0, 1)

-> Double

the shape parameter alpha

-> Double

the shape parameter beta

-> m Double 

Generate a random number from the Beta distribution.

generateWeibull01 Source #

Arguments

:: Monad m 
=> m Double

the uniform random number ~ U (0, 1)

-> Double

shape

-> Double

scale

-> m Double 

Generate a random number from the Weibull distribution.

generateDiscrete01 Source #

Arguments

:: Monad m 
=> m Double

the uniform random number ~ U (0, 1)

-> DiscretePDF a

a discrete probability density function

-> m a 

Generate a random value from the specified discrete distribution.