random-fu-0.1.4: Random number generation

Data.Random.Distribution.Bernoulli

Synopsis

Documentation

bernoulli :: Distribution (Bernoulli b) a => b -> RVar aSource

Generate a Bernoulli variate with the given probability. For `Bool` results, `bernoulli p` will return True (p*100)% of the time and False otherwise. For numerical types, True is replaced by 1 and False by 0.

bernoulliT :: Distribution (Bernoulli b) a => b -> RVarT m aSource

Generate a Bernoulli process with the given probability. For `Bool` results, `bernoulli p` will return True (p*100)% of the time and False otherwise. For numerical types, True is replaced by 1 and False by 0.

boolBernoulli :: (Fractional a, Ord a, Distribution StdUniform a) => a -> RVarT m BoolSource

A random variable whose value is `True` the given fraction of the time and `False` the rest.

generalBernoulli :: Distribution (Bernoulli b) Bool => a -> a -> b -> RVarT m aSource

`generalBernoulli t f p` generates a random variable whose value is `t` with probability `p` and `f` with probability `1-p`.

generalBernoulliCDF :: CDF (Bernoulli b) Bool => (a -> a -> Bool) -> a -> a -> b -> a -> DoubleSource

data Bernoulli b a Source

Constructors

 Bernoulli b

Instances

 (Distribution (Bernoulli b) Bool, Real b) => CDF (Bernoulli b) Bool CDF (Bernoulli b[a16gD]) Bool => CDF (Bernoulli b[a16gD]) Word64 CDF (Bernoulli b[a16gz]) Bool => CDF (Bernoulli b[a16gz]) Word32 CDF (Bernoulli b[a16gv]) Bool => CDF (Bernoulli b[a16gv]) Word16 CDF (Bernoulli b[a16gr]) Bool => CDF (Bernoulli b[a16gr]) Word8 CDF (Bernoulli b[a16gn]) Bool => CDF (Bernoulli b[a16gn]) Word CDF (Bernoulli b[a16gj]) Bool => CDF (Bernoulli b[a16gj]) Int64 CDF (Bernoulli b[a16gf]) Bool => CDF (Bernoulli b[a16gf]) Int32 CDF (Bernoulli b[a16gb]) Bool => CDF (Bernoulli b[a16gb]) Int16 CDF (Bernoulli b[a16g7]) Bool => CDF (Bernoulli b[a16g7]) Int8 CDF (Bernoulli b[a16g3]) Bool => CDF (Bernoulli b[a16g3]) Int CDF (Bernoulli b[a16fW]) Bool => CDF (Bernoulli b[a16fW]) Integer CDF (Bernoulli b[a16tS]) Bool => CDF (Bernoulli b[a16tS]) Double CDF (Bernoulli b[a16tO]) Bool => CDF (Bernoulli b[a16tO]) Float (Fractional b, Ord b, Distribution StdUniform b) => Distribution (Bernoulli b) Bool Distribution (Bernoulli b[a16gB]) Bool => Distribution (Bernoulli b[a16gB]) Word64 Distribution (Bernoulli b[a16gx]) Bool => Distribution (Bernoulli b[a16gx]) Word32 Distribution (Bernoulli b[a16gt]) Bool => Distribution (Bernoulli b[a16gt]) Word16 Distribution (Bernoulli b[a16gp]) Bool => Distribution (Bernoulli b[a16gp]) Word8 Distribution (Bernoulli b[a16gl]) Bool => Distribution (Bernoulli b[a16gl]) Word Distribution (Bernoulli b[a16gh]) Bool => Distribution (Bernoulli b[a16gh]) Int64 Distribution (Bernoulli b[a16gd]) Bool => Distribution (Bernoulli b[a16gd]) Int32 Distribution (Bernoulli b[a16g9]) Bool => Distribution (Bernoulli b[a16g9]) Int16 Distribution (Bernoulli b[a16g5]) Bool => Distribution (Bernoulli b[a16g5]) Int8 Distribution (Bernoulli b[a16g1]) Bool => Distribution (Bernoulli b[a16g1]) Int Distribution (Bernoulli b[a16fU]) Bool => Distribution (Bernoulli b[a16fU]) Integer Distribution (Bernoulli b[a16tQ]) Bool => Distribution (Bernoulli b[a16tQ]) Double Distribution (Bernoulli b[a16tM]) Bool => Distribution (Bernoulli b[a16tM]) Float (CDF (Bernoulli b) Bool, RealFloat a) => CDF (Bernoulli b) (Complex a) (CDF (Bernoulli b) Bool, Integral a) => CDF (Bernoulli b) (Ratio a) (Distribution (Bernoulli b) Bool, RealFloat a) => Distribution (Bernoulli b) (Complex a) (Distribution (Bernoulli b) Bool, Integral a) => Distribution (Bernoulli b) (Ratio a)