Copyright | Copyright (c) 2009-2017 David Sorokin <david.sorokin@gmail.com> |
---|---|
License | BSD3 |
Maintainer | David Sorokin <david.sorokin@gmail.com> |
Stability | experimental |
Safe Haskell | Safe |
Language | Haskell2010 |
Tested with: GHC 8.0.1
This helper module defines primitives for generating random numbers.
- generateUniform01 :: Monad m => m Double -> Double -> Double -> m Double
- generateUniformInt01 :: Monad m => m Double -> Int -> Int -> m Int
- generateTriangular01 :: Monad m => m Double -> Double -> Double -> Double -> m Double
- generateNormal01 :: Monad m => m Double -> Double -> Double -> m Double
- generateLogNormal01 :: Monad m => m Double -> Double -> Double -> m Double
- generateExponential01 :: Monad m => m Double -> Double -> m Double
- generateErlang01 :: Monad m => m Double -> Double -> Int -> m Double
- generatePoisson01 :: Monad m => m Double -> Double -> m Int
- generateBinomial01 :: Monad m => m Double -> Double -> Int -> m Int
- generateGamma01 :: Monad m => m Double -> m Double -> Double -> Double -> m Double
- generateBeta01 :: Monad m => m Double -> m Double -> Double -> Double -> m Double
- generateWeibull01 :: Monad m => m Double -> Double -> Double -> m Double
- generateDiscrete01 :: Monad m => m Double -> DiscretePDF a -> m a
Documentation
:: 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.
Generate an uniform random number with the specified minimum and maximum.
:: 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.
Generate a normal random number by the specified generator, mean and variance.
Generate the lognormal random number derived from a normal distribution with the specified generator, mean and variance.
generateExponential01 Source #
Return the exponential random number with the specified mean.
:: Monad m | |
=> m Double | the uniform random number ~ U (0, 1) |
-> Double | the scale |
-> Int | the shape |
-> m Double |
Return the Erlang random number.
Generate the Poisson random number with the specified mean.
:: 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.
:: 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.
:: 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.
Generate a random number from the Weibull distribution.
:: 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.