random-fu-0.1.3: 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[aRSs]) Bool => CDF (Bernoulli b[aRSs]) Word64 CDF (Bernoulli b[aRSo]) Bool => CDF (Bernoulli b[aRSo]) Word32 CDF (Bernoulli b[aRSk]) Bool => CDF (Bernoulli b[aRSk]) Word16 CDF (Bernoulli b[aRSg]) Bool => CDF (Bernoulli b[aRSg]) Word8 CDF (Bernoulli b[aRSc]) Bool => CDF (Bernoulli b[aRSc]) Word CDF (Bernoulli b[aRS8]) Bool => CDF (Bernoulli b[aRS8]) Int64 CDF (Bernoulli b[aRS4]) Bool => CDF (Bernoulli b[aRS4]) Int32 CDF (Bernoulli b[aRS0]) Bool => CDF (Bernoulli b[aRS0]) Int16 CDF (Bernoulli b[aRRW]) Bool => CDF (Bernoulli b[aRRW]) Int8 CDF (Bernoulli b[aRRS]) Bool => CDF (Bernoulli b[aRRS]) Int CDF (Bernoulli b[aRRL]) Bool => CDF (Bernoulli b[aRRL]) Integer CDF (Bernoulli b[aS9R]) Bool => CDF (Bernoulli b[aS9R]) Double CDF (Bernoulli b[aS9N]) Bool => CDF (Bernoulli b[aS9N]) Float (Fractional b, Ord b, Distribution StdUniform b) => Distribution (Bernoulli b) Bool Distribution (Bernoulli b[aRSq]) Bool => Distribution (Bernoulli b[aRSq]) Word64 Distribution (Bernoulli b[aRSm]) Bool => Distribution (Bernoulli b[aRSm]) Word32 Distribution (Bernoulli b[aRSi]) Bool => Distribution (Bernoulli b[aRSi]) Word16 Distribution (Bernoulli b[aRSe]) Bool => Distribution (Bernoulli b[aRSe]) Word8 Distribution (Bernoulli b[aRSa]) Bool => Distribution (Bernoulli b[aRSa]) Word Distribution (Bernoulli b[aRS6]) Bool => Distribution (Bernoulli b[aRS6]) Int64 Distribution (Bernoulli b[aRS2]) Bool => Distribution (Bernoulli b[aRS2]) Int32 Distribution (Bernoulli b[aRRY]) Bool => Distribution (Bernoulli b[aRRY]) Int16 Distribution (Bernoulli b[aRRU]) Bool => Distribution (Bernoulli b[aRRU]) Int8 Distribution (Bernoulli b[aRRQ]) Bool => Distribution (Bernoulli b[aRRQ]) Int Distribution (Bernoulli b[aRRJ]) Bool => Distribution (Bernoulli b[aRRJ]) Integer Distribution (Bernoulli b[aS9P]) Bool => Distribution (Bernoulli b[aS9P]) Double Distribution (Bernoulli b[aS9L]) Bool => Distribution (Bernoulli b[aS9L]) 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)