random-fu-0.3.0.1: Random number generation

Safe Haskell | None
Language | Haskell2010

Data.Random.Distribution.Bernoulli

Synopsis

- bernoulli :: Distribution (Bernoulli b) a => b -> RVar a
- bernoulliT :: forall b a (m :: Type -> Type). Distribution (Bernoulli b) a => b -> RVarT m a
- boolBernoulli :: forall a (m :: Type -> Type). (Fractional a, Ord a, Distribution StdUniform a) => a -> RVarT m Bool
- boolBernoulliCDF :: Real a => a -> Bool -> Double
- generalBernoulli :: forall b a (m :: Type -> Type). Distribution (Bernoulli b) Bool => a -> a -> b -> RVarT m a
- generalBernoulliCDF :: CDF (Bernoulli b) Bool => (a -> a -> Bool) -> a -> a -> b -> a -> Double
- newtype Bernoulli b a = Bernoulli b

# Documentation

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

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 :: forall b a (m :: Type -> Type). Distribution (Bernoulli b) a => b -> RVarT m a Source #

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 :: forall a (m :: Type -> Type). (Fractional a, Ord a, Distribution StdUniform a) => a -> RVarT m Bool Source #

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

boolBernoulliCDF :: Real a => a -> Bool -> Double Source #

generalBernoulli :: forall b a (m :: Type -> Type). Distribution (Bernoulli b) Bool => a -> a -> b -> RVarT m a Source #

`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 -> Double Source #

newtype Bernoulli b a Source #

Constructors

Bernoulli b |

#### Instances

Instances details

CDF (Bernoulli b) Bool => CDF (Bernoulli b) Int16 Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods cdf :: Bernoulli b Int16 -> Int16 -> Double Source #
CDF (Bernoulli b) Bool => CDF (Bernoulli b) Int32 Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods cdf :: Bernoulli b Int32 -> Int32 -> Double Source #
CDF (Bernoulli b) Bool => CDF (Bernoulli b) Int64 Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods cdf :: Bernoulli b Int64 -> Int64 -> Double Source #
CDF (Bernoulli b) Bool => CDF (Bernoulli b) Int8 Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods cdf :: Bernoulli b Int8 -> Int8 -> Double Source #
CDF (Bernoulli b) Bool => CDF (Bernoulli b) Word16 Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods cdf :: Bernoulli b Word16 -> Word16 -> Double Source #
CDF (Bernoulli b) Bool => CDF (Bernoulli b) Word32 Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods cdf :: Bernoulli b Word32 -> Word32 -> Double Source #
CDF (Bernoulli b) Bool => CDF (Bernoulli b) Word64 Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods cdf :: Bernoulli b Word64 -> Word64 -> Double Source #
CDF (Bernoulli b) Bool => CDF (Bernoulli b) Word8 Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods cdf :: Bernoulli b Word8 -> Word8 -> Double Source #
CDF (Bernoulli b) Bool => CDF (Bernoulli b) Integer Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods cdf :: Bernoulli b Integer -> Integer -> Double Source #
(Distribution (Bernoulli b) Bool, Real b) => CDF (Bernoulli b) Bool Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods cdf :: Bernoulli b Bool -> Bool -> Double Source #
CDF (Bernoulli b) Bool => CDF (Bernoulli b) Double Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods cdf :: Bernoulli b Double -> Double -> Double Source #
CDF (Bernoulli b) Bool => CDF (Bernoulli b) Float Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods cdf :: Bernoulli b Float -> Float -> Double Source #
CDF (Bernoulli b) Bool => CDF (Bernoulli b) Int Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods cdf :: Bernoulli b Int -> Int -> Double Source #
CDF (Bernoulli b) Bool => CDF (Bernoulli b) Word Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods cdf :: Bernoulli b Word -> Word -> Double Source #
Distribution (Bernoulli b) Bool => Distribution (Bernoulli b) Int16 Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods rvar :: Bernoulli b Int16 -> RVar Int16 Source # rvarT :: forall (n :: Type -> Type). Bernoulli b Int16 -> RVarT n Int16 Source #
Distribution (Bernoulli b) Bool => Distribution (Bernoulli b) Int32 Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods rvar :: Bernoulli b Int32 -> RVar Int32 Source # rvarT :: forall (n :: Type -> Type). Bernoulli b Int32 -> RVarT n Int32 Source #
Distribution (Bernoulli b) Bool => Distribution (Bernoulli b) Int64 Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods rvar :: Bernoulli b Int64 -> RVar Int64 Source # rvarT :: forall (n :: Type -> Type). Bernoulli b Int64 -> RVarT n Int64 Source #
Distribution (Bernoulli b) Bool => Distribution (Bernoulli b) Int8 Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods rvar :: Bernoulli b Int8 -> RVar Int8 Source # rvarT :: forall (n :: Type -> Type). Bernoulli b Int8 -> RVarT n Int8 Source #
Distribution (Bernoulli b) Bool => Distribution (Bernoulli b) Word16 Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods rvar :: Bernoulli b Word16 -> RVar Word16 Source # rvarT :: forall (n :: Type -> Type). Bernoulli b Word16 -> RVarT n Word16 Source #
Distribution (Bernoulli b) Bool => Distribution (Bernoulli b) Word32 Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods rvar :: Bernoulli b Word32 -> RVar Word32 Source # rvarT :: forall (n :: Type -> Type). Bernoulli b Word32 -> RVarT n Word32 Source #
Distribution (Bernoulli b) Bool => Distribution (Bernoulli b) Word64 Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods rvar :: Bernoulli b Word64 -> RVar Word64 Source # rvarT :: forall (n :: Type -> Type). Bernoulli b Word64 -> RVarT n Word64 Source #
Distribution (Bernoulli b) Bool => Distribution (Bernoulli b) Word8 Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods rvar :: Bernoulli b Word8 -> RVar Word8 Source # rvarT :: forall (n :: Type -> Type). Bernoulli b Word8 -> RVarT n Word8 Source #
Distribution (Bernoulli b) Bool => Distribution (Bernoulli b) Integer Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods rvar :: Bernoulli b Integer -> RVar Integer Source # rvarT :: forall (n :: Type -> Type). Bernoulli b Integer -> RVarT n Integer Source #
(Fractional b, Ord b, Distribution StdUniform b) => Distribution (Bernoulli b) Bool Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods rvar :: Bernoulli b Bool -> RVar Bool Source # rvarT :: forall (n :: Type -> Type). Bernoulli b Bool -> RVarT n Bool Source #
Distribution (Bernoulli b) Bool => Distribution (Bernoulli b) Double Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods rvar :: Bernoulli b Double -> RVar Double Source # rvarT :: forall (n :: Type -> Type). Bernoulli b Double -> RVarT n Double Source #
Distribution (Bernoulli b) Bool => Distribution (Bernoulli b) Float Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods rvar :: Bernoulli b Float -> RVar Float Source # rvarT :: forall (n :: Type -> Type). Bernoulli b Float -> RVarT n Float Source #
Distribution (Bernoulli b) Bool => Distribution (Bernoulli b) Int Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods rvar :: Bernoulli b Int -> RVar Int Source # rvarT :: forall (n :: Type -> Type). Bernoulli b Int -> RVarT n Int Source #
Distribution (Bernoulli b) Bool => Distribution (Bernoulli b) Word Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods rvar :: Bernoulli b Word -> RVar Word Source # rvarT :: forall (n :: Type -> Type). Bernoulli b Word -> RVarT n Word Source #
(CDF (Bernoulli b) Bool, RealFloat a) => CDF (Bernoulli b) (Complex a) Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods cdf :: Bernoulli b (Complex a) -> Complex a -> Double Source #
(CDF (Bernoulli b) Bool, Integral a) => CDF (Bernoulli b) (Ratio a) Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods cdf :: Bernoulli b (Ratio a) -> Ratio a -> Double Source #
(Distribution (Bernoulli b) Bool, RealFloat a) => Distribution (Bernoulli b) (Complex a) Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods rvar :: Bernoulli b (Complex a) -> RVar (Complex a) Source # rvarT :: forall (n :: Type -> Type). Bernoulli b (Complex a) -> RVarT n (Complex a) Source #
(Distribution (Bernoulli b) Bool, Integral a) => Distribution (Bernoulli b) (Ratio a) Source # |
Instance details Defined in Data.Random.Distribution.Bernoulli Methods rvar :: Bernoulli b (Ratio a) -> RVar (Ratio a) Source # rvarT :: forall (n :: Type -> Type). Bernoulli b (Ratio a) -> RVarT n (Ratio a) Source #