random-fu-0.2: 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[aETw]) Bool => CDF (Bernoulli b[aETw]) Word64 CDF (Bernoulli b[aETs]) Bool => CDF (Bernoulli b[aETs]) Word32 CDF (Bernoulli b[aETo]) Bool => CDF (Bernoulli b[aETo]) Word16 CDF (Bernoulli b[aETk]) Bool => CDF (Bernoulli b[aETk]) Word8 CDF (Bernoulli b[aETg]) Bool => CDF (Bernoulli b[aETg]) Word CDF (Bernoulli b[aETc]) Bool => CDF (Bernoulli b[aETc]) Int64 CDF (Bernoulli b[aET8]) Bool => CDF (Bernoulli b[aET8]) Int32 CDF (Bernoulli b[aET4]) Bool => CDF (Bernoulli b[aET4]) Int16 CDF (Bernoulli b[aET0]) Bool => CDF (Bernoulli b[aET0]) Int8 CDF (Bernoulli b[aESW]) Bool => CDF (Bernoulli b[aESW]) Int CDF (Bernoulli b[aESP]) Bool => CDF (Bernoulli b[aESP]) Integer CDF (Bernoulli b[aF6L]) Bool => CDF (Bernoulli b[aF6L]) Double CDF (Bernoulli b[aF6H]) Bool => CDF (Bernoulli b[aF6H]) Float (Fractional b, Ord b, Distribution StdUniform b) => Distribution (Bernoulli b) Bool Distribution (Bernoulli b[aETu]) Bool => Distribution (Bernoulli b[aETu]) Word64 Distribution (Bernoulli b[aETq]) Bool => Distribution (Bernoulli b[aETq]) Word32 Distribution (Bernoulli b[aETm]) Bool => Distribution (Bernoulli b[aETm]) Word16 Distribution (Bernoulli b[aETi]) Bool => Distribution (Bernoulli b[aETi]) Word8 Distribution (Bernoulli b[aETe]) Bool => Distribution (Bernoulli b[aETe]) Word Distribution (Bernoulli b[aETa]) Bool => Distribution (Bernoulli b[aETa]) Int64 Distribution (Bernoulli b[aET6]) Bool => Distribution (Bernoulli b[aET6]) Int32 Distribution (Bernoulli b[aET2]) Bool => Distribution (Bernoulli b[aET2]) Int16 Distribution (Bernoulli b[aESY]) Bool => Distribution (Bernoulli b[aESY]) Int8 Distribution (Bernoulli b[aESU]) Bool => Distribution (Bernoulli b[aESU]) Int Distribution (Bernoulli b[aESN]) Bool => Distribution (Bernoulli b[aESN]) Integer Distribution (Bernoulli b[aF6J]) Bool => Distribution (Bernoulli b[aF6J]) Double Distribution (Bernoulli b[aF6F]) Bool => Distribution (Bernoulli b[aF6F]) 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)