aivika-4.2: A multi-paradigm simulation library

Copyright Copyright (c) 2009-2015, David Sorokin BSD3 David Sorokin experimental Safe-Inferred Haskell2010

Simulation.Aivika.Generator

Description

Tested with: GHC 7.10.1

Below is defined a type class of the random number generator.

Synopsis

# Documentation

data Generator Source

Defines a random number generator.

Constructors

 Generator FieldsgenerateUniform :: Double -> Double -> IO DoubleGenerate an uniform random number with the specified minimum and maximum.generateUniformInt :: Int -> Int -> IO IntGenerate an uniform integer random number with the specified minimum and maximum.generateTriangular :: Double -> Double -> Double -> IO DoubleGenerate a triangular random number by the specified minimum, median and maximum.generateNormal :: Double -> Double -> IO DoubleGenerate the normal random number with the specified mean and deviation.generateLogNormal :: Double -> Double -> IO DoubleGenerate a random number from the lognormal distribution derived from a normal distribution with the specified mean and deviation.generateExponential :: Double -> IO DoubleGenerate the random number distributed exponentially with the specified mean (the reciprocal of the rate).generateErlang :: Double -> Int -> IO DoubleGenerate the Erlang random number with the specified scale (the reciprocal of the rate) and integer shape.generatePoisson :: Double -> IO IntGenerate the Poisson random number with the specified mean.generateBinomial :: Double -> Int -> IO IntGenerate the binomial random number with the specified probability and number of trials.generateGamma :: Double -> Double -> IO DoubleGenerate a random number from the Gamma distribution with the specified shape (kappa) and scale (theta, a reciprocal of the rate).The probability density for the Gamma distribution is`f x = x ** (kappa - 1) * exp (- x / theta) / theta ** kappa * Gamma kappa`generateBeta :: Double -> Double -> IO DoubleGenerate a random number from the Beta distribution by the specified shape parameters (alpha and beta).The probability density for the Beta distribution is`f x = x ** (alpha - 1) * (1 - x) ** (beta - 1) / B alpha beta`generateWeibull :: Double -> Double -> IO DoubleGenerate a random number from the Weibull distribution by the specified shape and scale.generateDiscrete :: forall a. DiscretePDF a -> IO aGenerate a random value from the specified discrete distribution.

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 (IO Generator) The custom random number generator. CustomGenerator01 (IO Double) The custom random number generator by the specified uniform generator of numbers from 0 to 1.

type DiscretePDF a = [(a, Double)] Source

A discrete probability density function.

Create a new random number generator by the specified type.

newRandomGenerator :: RandomGen g => g -> IO Generator Source

Create a new random generator by the specified standard generator.