Portability | portable |
---|---|
Stability | experimental |
Maintainer | bos@serpentine.com |
Safe Haskell | None |
Pseudo-random number generation for non-uniform distributions.
- normal :: PrimMonad m => Double -> Double -> Gen (PrimState m) -> m Double
- standard :: PrimMonad m => Gen (PrimState m) -> m Double
- exponential :: PrimMonad m => Double -> Gen (PrimState m) -> m Double
- truncatedExp :: PrimMonad m => Double -> (Double, Double) -> Gen (PrimState m) -> m Double
- gamma :: PrimMonad m => Double -> Double -> Gen (PrimState m) -> m Double
- chiSquare :: PrimMonad m => Int -> Gen (PrimState m) -> m Double
- geometric0 :: PrimMonad m => Double -> Gen (PrimState m) -> m Int
- geometric1 :: PrimMonad m => Double -> Gen (PrimState m) -> m Int
Variates: non-uniformly distributed values
Generate a normally distributed random variate with given mean and standard deviation.
standard :: PrimMonad m => Gen (PrimState m) -> m DoubleSource
Generate a normally distributed random variate with zero mean and unit variance.
The implementation uses Doornik's modified ziggurat algorithm. Compared to the ziggurat algorithm usually used, this is slower, but generates more independent variates that pass stringent tests of randomness.
Generate an exponentially distributed random variate.
:: PrimMonad m | |
=> Double | Scale parameter |
-> (Double, Double) | Range to which distribution is truncated. Values may be negative. |
-> Gen (PrimState m) | Generator. |
-> m Double |
Generate truncated exponentially distributed random variate.
:: PrimMonad m | |
=> Double | Shape parameter |
-> Double | Scale parameter |
-> Gen (PrimState m) | Generator |
-> m Double |
Random variate generator for gamma distribution.
Random variate generator for the chi square distribution.
Random variate generator for the geometric distribution, computing the number of failures before success. Distribution's support is [0..].
Random variate generator for geometric distribution for number of
trials. Distribution's support is [1..] (i.e. just geometric0
shifted by 1).
References
- Doornik, J.A. (2005) An improved ziggurat method to generate normal random samples. Mimeo, Nuffield College, University of Oxford. http://www.doornik.com/research/ziggurat.pdf
- Thomas, D.B.; Leong, P.G.W.; Luk, W.; Villasenor, J.D. (2007). Gaussian random number generators. ACM Computing Surveys 39(4). http://www.cse.cuhk.edu.hk/~phwl/mt/public/archives/papers/grng_acmcs07.pdf