mwc-random-0.13.1.0: Fast, high quality pseudo random number generation

Portabilityportable
Stabilityexperimental
Maintainerbos@serpentine.com
Safe HaskellNone

System.Random.MWC.Distributions

Contents

Description

Pseudo-random number generation for non-uniform distributions.

Synopsis

Variates: non-uniformly distributed values

normalSource

Arguments

:: PrimMonad m 
=> Double

Mean

-> Double

Standard deviation

-> Gen (PrimState m) 
-> m Double 

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.

exponentialSource

Arguments

:: PrimMonad m 
=> Double

Scale parameter

-> Gen (PrimState m)

Generator

-> m Double 

Generate an exponentially distributed random variate.

truncatedExpSource

Arguments

:: 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.

gammaSource

Arguments

:: PrimMonad m 
=> Double

Shape parameter

-> Double

Scale parameter

-> Gen (PrimState m)

Generator

-> m Double 

Random variate generator for gamma distribution.

chiSquareSource

Arguments

:: PrimMonad m 
=> Int

Number of degrees of freedom

-> Gen (PrimState m)

Generator

-> m Double 

Random variate generator for the chi square distribution.

geometric0Source

Arguments

:: PrimMonad m 
=> Double

p success probability lies in (0,1]

-> Gen (PrimState m)

Generator

-> m Int 

Random variate generator for the geometric distribution, computing the number of failures before success. Distribution's support is [0..].

geometric1Source

Arguments

:: PrimMonad m 
=> Double

p success probability lies in (0,1]

-> Gen (PrimState m)

Generator

-> m Int 

Random variate generator for geometric distribution for number of trials. Distribution's support is [1..] (i.e. just geometric0 shifted by 1).

References