Portability | portable |
---|---|
Stability | experimental |
Maintainer | bos@serpentine.com |
Safe Haskell | Safe-Infered |
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
- gamma :: PrimMonad m => Double -> Double -> Gen (PrimState m) -> m Double
- chiSquare :: PrimMonad m => Int -> Gen (PrimState m) -> m Double
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 | 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.
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
- Doornik, J.A. (2007) Conversion of high-period random numbers to floating point. ACM Transactions on Modeling and Computer Simulation 17(1). http://www.doornik.com/research/randomdouble.pdf