aivika-5.9.1: A multi-method simulation library
Copyright Copyright (c) 2009-2017 David Sorokin BSD3 David Sorokin experimental None Haskell2010

Simulation.Aivika.Generator

Description

Tested with: GHC 8.0.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 isf x = x ** (kappa - 1) * exp (- x / theta) / theta ** kappa * Gamma kappagenerateBeta :: 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 isf x = x ** (alpha - 1) * (1 - x) ** (beta - 1) / B alpha betagenerateWeibull :: 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.generateSequenceNo :: IO IntGenerate a sequence number which can be considered quite unique.

Defines a type of the random number generator.

Constructors

 SimpleGenerator The simple random number generator. SimpleGeneratorWithSeed Word32 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.

Create a new random generator by the specified standard generator.

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