random-fu-0.2.7.7: Random number generation

Data.Random.Distribution.Normal

Synopsis

# Documentation

data Normal a Source #

A specification of a normal distribution over the type a.

Constructors

 StdNormal The "standard" normal distribution - mean 0, stddev 1 Normal a a Normal m s is a normal distribution with mean m and stddev sd.
Instances
 (Real a, Distribution Normal a) => CDF Normal a Source # Instance detailsDefined in Data.Random.Distribution.Normal Methodscdf :: Normal a -> a -> Double Source # (Real a, Floating a, Distribution Normal a) => PDF Normal a Source # Instance detailsDefined in Data.Random.Distribution.Normal Methodspdf :: Normal a -> a -> Double Source #logPdf :: Normal a -> a -> Double Source # Source # Instance detailsDefined in Data.Random.Distribution.Normal Methods Source # Instance detailsDefined in Data.Random.Distribution.Normal Methods

normal :: Distribution Normal a => a -> a -> RVar a Source #

normal m s is a random variable with distribution Normal m s.

normalT :: Distribution Normal a => a -> a -> RVarT m a Source #

normalT m s is a random process with distribution Normal m s.

stdNormal is a normal variable with distribution StdNormal.

stdNormalT is a normal process with distribution StdNormal.

A random variable sampling from the standard normal distribution over the Double type.

A random variable sampling from the standard normal distribution over the Float type.

realFloatStdNormal :: (RealFloat a, Erf a, Distribution Uniform a) => RVarT m a Source #

A random variable sampling from the standard normal distribution over any RealFloat type (subject to the rest of the constraints - it builds and uses a Ziggurat internally, which requires the Erf class).

Because it computes a Ziggurat, it is very expensive to use for just one evaluation, or even for multiple evaluations if not used and reused monomorphically (to enable the ziggurat table to be let-floated out). If you don't know whether your use case fits this description then you're probably better off using a different algorithm, such as boxMullerNormalPair or knuthPolarNormalPair. And of course if you don't need the full generality of this definition then you're much better off using doubleStdNormal or floatStdNormal.

As far as I know, this should be safe to use in any monomorphic Distribution Normal instance declaration.

normalTail :: (Distribution StdUniform a, Floating a, Ord a) => a -> RVarT m a Source #

Draw from the tail of a normal distribution (the region beyond the provided value)

normalPair :: (Floating a, Distribution StdUniform a) => RVar (a, a) Source #

A random variable that produces a pair of independent normally-distributed values.

boxMullerNormalPair :: (Floating a, Distribution StdUniform a) => RVar (a, a) Source #

A random variable that produces a pair of independent normally-distributed values, computed using the Box-Muller method. This algorithm is slightly slower than Knuth's method but using a constant amount of entropy (Knuth's method is a rejection method). It is also slightly more general (Knuth's method require an Ord instance).

knuthPolarNormalPair :: (Floating a, Ord a, Distribution Uniform a) => RVar (a, a) Source #

A random variable that produces a pair of independent normally-distributed values, computed using Knuth's polar method. Slightly faster than boxMullerNormalPair when it accepts on the first try, but does not always do so.