random-fu-0.3.0.1: Random number generation
Safe HaskellSafe-Inferred
LanguageHaskell2010

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

Instances details
(Real a, Distribution Normal a) => CDF Normal a Source # 
Instance details

Defined in Data.Random.Distribution.Normal

Methods

cdf :: Normal a -> a -> Double Source #

Distribution Normal Double Source # 
Instance details

Defined in Data.Random.Distribution.Normal

Methods

rvar :: Normal Double -> RVar Double Source #

rvarT :: forall (n :: Type -> Type). Normal Double -> RVarT n Double Source #

Distribution Normal Float Source # 
Instance details

Defined in Data.Random.Distribution.Normal

Methods

rvar :: Normal Float -> RVar Float Source #

rvarT :: forall (n :: Type -> Type). Normal Float -> RVarT n Float Source #

(Real a, Floating a, Distribution Normal a) => PDF Normal a Source # 
Instance details

Defined in Data.Random.Distribution.Normal

Methods

pdf :: Normal a -> a -> Double Source #

logPdf :: Normal a -> a -> Double Source #

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 :: Distribution Normal a => RVar a Source #

stdNormal is a normal variable with distribution StdNormal.

stdNormalT :: Distribution Normal a => RVarT m a Source #

stdNormalT is a normal process with distribution StdNormal.

doubleStdNormal :: RVarT m Double Source #

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

floatStdNormal :: RVarT m Float Source #

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.