random-fu-0.3.0.1: Random number generation

Safe Haskell | None
Language | Haskell2010

Data.Random.Distribution.Uniform

Synopsis

- data Uniform t = Uniform !t !t
- uniform :: Distribution Uniform a => a -> a -> RVar a
- uniformT :: forall a (m :: Type -> Type). Distribution Uniform a => a -> a -> RVarT m a
- data StdUniform t = StdUniform
- stdUniform :: Distribution StdUniform a => RVar a
- stdUniformT :: forall a (m :: Type -> Type). Distribution StdUniform a => RVarT m a
- stdUniformPos :: (Distribution StdUniform a, Num a, Eq a) => RVar a
- stdUniformPosT :: forall a (m :: Type -> Type). (Distribution StdUniform a, Num a, Eq a) => RVarT m a
- integralUniform :: forall a (m :: Type -> Type). UniformRange a => a -> a -> RVarT m a
- realFloatUniform :: forall a (m :: Type -> Type). RealFloat a => a -> a -> RVarT m a
- floatUniform :: forall (m :: Type -> Type). Float -> Float -> RVarT m Float
- doubleUniform :: forall (m :: Type -> Type). Double -> Double -> RVarT m Double
- fixedUniform :: forall r (m :: Type -> Type). HasResolution r => Fixed r -> Fixed r -> RVarT m (Fixed r)
- enumUniform :: forall a (m :: Type -> Type). Enum a => a -> a -> RVarT m a
- boundedStdUniform :: (Distribution Uniform a, Bounded a) => RVar a
- boundedEnumStdUniform :: forall a (m :: Type -> Type). (Enum a, Bounded a) => RVarT m a
- realFloatStdUniform :: forall a (m :: Type -> Type). RealFloat a => RVarT m a
- fixedStdUniform :: forall r (m :: Type -> Type). HasResolution r => RVarT m (Fixed r)
- floatStdUniform :: forall (m :: Type -> Type). RVarT m Float
- doubleStdUniform :: forall (m :: Type -> Type). RVarT m Double
- boundedStdUniformCDF :: (CDF Uniform a, Bounded a) => a -> Double
- realStdUniformCDF :: Real a => a -> Double
- realUniformCDF :: RealFrac a => a -> a -> a -> Double
- enumUniformCDF :: (Enum a, Ord a) => a -> a -> a -> Double

# Documentation

data Uniform t Source #

A definition of a uniform distribution over the type `t`. See also `uniform`.

Constructors

Uniform !t !t | A uniform distribution defined by a lower and upper range bound. For `Integral` and `Enum` types, the range is inclusive. For `Fractional` types the range includes the lower bound but not the upper.

#### Instances

Instances details

CDF Uniform Int16 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: Uniform Int16 -> Int16 -> Double Source #
CDF Uniform Int32 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: Uniform Int32 -> Int32 -> Double Source #
CDF Uniform Int64 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: Uniform Int64 -> Int64 -> Double Source #
CDF Uniform Int8 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: Uniform Int8 -> Int8 -> Double Source #
CDF Uniform Word16 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: Uniform Word16 -> Word16 -> Double Source #
CDF Uniform Word32 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: Uniform Word32 -> Word32 -> Double Source #
CDF Uniform Word64 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: Uniform Word64 -> Word64 -> Double Source #
CDF Uniform Word8 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: Uniform Word8 -> Word8 -> Double Source #
CDF Uniform Ordering Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: Uniform Ordering -> Ordering -> Double Source #
CDF Uniform Integer Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: Uniform Integer -> Integer -> Double Source #
CDF Uniform () Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: Uniform () -> () -> Double Source #
CDF Uniform Bool Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: Uniform Bool -> Bool -> Double Source #
CDF Uniform Char Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: Uniform Char -> Char -> Double Source #
CDF Uniform Double Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: Uniform Double -> Double -> Double Source #
CDF Uniform Float Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: Uniform Float -> Float -> Double Source #
CDF Uniform Int Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: Uniform Int -> Int -> Double Source #
CDF Uniform Word Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: Uniform Word -> Word -> Double Source #
Distribution Uniform Int16 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: Uniform Int16 -> RVar Int16 Source # rvarT :: forall (n :: Type -> Type). Uniform Int16 -> RVarT n Int16 Source #
Distribution Uniform Int32 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: Uniform Int32 -> RVar Int32 Source # rvarT :: forall (n :: Type -> Type). Uniform Int32 -> RVarT n Int32 Source #
Distribution Uniform Int64 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: Uniform Int64 -> RVar Int64 Source # rvarT :: forall (n :: Type -> Type). Uniform Int64 -> RVarT n Int64 Source #
Distribution Uniform Int8 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: Uniform Int8 -> RVar Int8 Source # rvarT :: forall (n :: Type -> Type). Uniform Int8 -> RVarT n Int8 Source #
Distribution Uniform Word16 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: Uniform Word16 -> RVar Word16 Source # rvarT :: forall (n :: Type -> Type). Uniform Word16 -> RVarT n Word16 Source #
Distribution Uniform Word32 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: Uniform Word32 -> RVar Word32 Source # rvarT :: forall (n :: Type -> Type). Uniform Word32 -> RVarT n Word32 Source #
Distribution Uniform Word64 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: Uniform Word64 -> RVar Word64 Source # rvarT :: forall (n :: Type -> Type). Uniform Word64 -> RVarT n Word64 Source #
Distribution Uniform Word8 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: Uniform Word8 -> RVar Word8 Source # rvarT :: forall (n :: Type -> Type). Uniform Word8 -> RVarT n Word8 Source #
Distribution Uniform Ordering Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: Uniform Ordering -> RVar Ordering Source # rvarT :: forall (n :: Type -> Type). Uniform Ordering -> RVarT n Ordering Source #
Distribution Uniform Integer Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: Uniform Integer -> RVar Integer Source # rvarT :: forall (n :: Type -> Type). Uniform Integer -> RVarT n Integer Source #
Distribution Uniform () Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: Uniform () -> RVar () Source # rvarT :: forall (n :: Type -> Type). Uniform () -> RVarT n () Source #
Distribution Uniform Bool Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: Uniform Bool -> RVar Bool Source # rvarT :: forall (n :: Type -> Type). Uniform Bool -> RVarT n Bool Source #
Distribution Uniform Char Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: Uniform Char -> RVar Char Source # rvarT :: forall (n :: Type -> Type). Uniform Char -> RVarT n Char Source #
Distribution Uniform Double Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: Uniform Double -> RVar Double Source # rvarT :: forall (n :: Type -> Type). Uniform Double -> RVarT n Double Source #
Distribution Uniform Float Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: Uniform Float -> RVar Float Source # rvarT :: forall (n :: Type -> Type). Uniform Float -> RVarT n Float Source #
Distribution Uniform Int Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: Uniform Int -> RVar Int Source # rvarT :: forall (n :: Type -> Type). Uniform Int -> RVarT n Int Source #
Distribution Uniform Word Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: Uniform Word -> RVar Word Source # rvarT :: forall (n :: Type -> Type). Uniform Word -> RVarT n Word Source #
HasResolution r => CDF Uniform (Fixed r) Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: Uniform (Fixed r) -> Fixed r -> Double Source #
HasResolution r => Distribution Uniform (Fixed r) Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: Uniform (Fixed r) -> RVar (Fixed r) Source # rvarT :: forall (n :: Type -> Type). Uniform (Fixed r) -> RVarT n (Fixed r) Source #

uniform :: Distribution Uniform a => a -> a -> RVar a Source #

uniformT :: forall a (m :: Type -> Type). Distribution Uniform a => a -> a -> RVarT m a Source #

data StdUniform t Source #

A name for the "standard" uniform distribution over the type `t`, if one exists. See also `stdUniform`.

For `Integral` and `Enum` types that are also `Bounded`, this is the uniform distribution over the full range of the type. For un-`Bounded` `Integral` types this is not defined. For `Fractional` types this is a random variable in the range [0,1) (that is, 0 to 1 including 0 but not including 1).

Constructors

StdUniform |

#### Instances

Instances details

CDF StdUniform Int16 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: StdUniform Int16 -> Int16 -> Double Source #
CDF StdUniform Int32 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: StdUniform Int32 -> Int32 -> Double Source #
CDF StdUniform Int64 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: StdUniform Int64 -> Int64 -> Double Source #
CDF StdUniform Int8 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: StdUniform Int8 -> Int8 -> Double Source #
CDF StdUniform Word16 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: StdUniform Word16 -> Word16 -> Double Source #
CDF StdUniform Word32 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: StdUniform Word32 -> Word32 -> Double Source #
CDF StdUniform Word64 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: StdUniform Word64 -> Word64 -> Double Source #
CDF StdUniform Word8 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: StdUniform Word8 -> Word8 -> Double Source #
CDF StdUniform Ordering Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: StdUniform Ordering -> Ordering -> Double Source #
CDF StdUniform () Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: StdUniform () -> () -> Double Source #
CDF StdUniform Bool Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: StdUniform Bool -> Bool -> Double Source #
CDF StdUniform Char Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: StdUniform Char -> Char -> Double Source #
CDF StdUniform Double Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: StdUniform Double -> Double -> Double Source #
CDF StdUniform Float Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: StdUniform Float -> Float -> Double Source #
CDF StdUniform Int Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: StdUniform Int -> Int -> Double Source #
CDF StdUniform Word Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: StdUniform Word -> Word -> Double Source #
Distribution StdUniform Int16 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: StdUniform Int16 -> RVar Int16 Source # rvarT :: forall (n :: Type -> Type). StdUniform Int16 -> RVarT n Int16 Source #
Distribution StdUniform Int32 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: StdUniform Int32 -> RVar Int32 Source # rvarT :: forall (n :: Type -> Type). StdUniform Int32 -> RVarT n Int32 Source #
Distribution StdUniform Int64 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: StdUniform Int64 -> RVar Int64 Source # rvarT :: forall (n :: Type -> Type). StdUniform Int64 -> RVarT n Int64 Source #
Distribution StdUniform Int8 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: StdUniform Int8 -> RVar Int8 Source # rvarT :: forall (n :: Type -> Type). StdUniform Int8 -> RVarT n Int8 Source #
Distribution StdUniform Word16 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: StdUniform Word16 -> RVar Word16 Source # rvarT :: forall (n :: Type -> Type). StdUniform Word16 -> RVarT n Word16 Source #
Distribution StdUniform Word32 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: StdUniform Word32 -> RVar Word32 Source # rvarT :: forall (n :: Type -> Type). StdUniform Word32 -> RVarT n Word32 Source #
Distribution StdUniform Word64 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: StdUniform Word64 -> RVar Word64 Source # rvarT :: forall (n :: Type -> Type). StdUniform Word64 -> RVarT n Word64 Source #
Distribution StdUniform Word8 Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: StdUniform Word8 -> RVar Word8 Source # rvarT :: forall (n :: Type -> Type). StdUniform Word8 -> RVarT n Word8 Source #
Distribution StdUniform Ordering Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: StdUniform Ordering -> RVar Ordering Source # rvarT :: forall (n :: Type -> Type). StdUniform Ordering -> RVarT n Ordering Source #
Distribution StdUniform () Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: StdUniform () -> RVar () Source # rvarT :: forall (n :: Type -> Type). StdUniform () -> RVarT n () Source #
Distribution StdUniform Bool Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: StdUniform Bool -> RVar Bool Source # rvarT :: forall (n :: Type -> Type). StdUniform Bool -> RVarT n Bool Source #
Distribution StdUniform Char Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: StdUniform Char -> RVar Char Source # rvarT :: forall (n :: Type -> Type). StdUniform Char -> RVarT n Char Source #
Distribution StdUniform Double Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: StdUniform Double -> RVar Double Source # rvarT :: forall (n :: Type -> Type). StdUniform Double -> RVarT n Double Source #
Distribution StdUniform Float Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: StdUniform Float -> RVar Float Source # rvarT :: forall (n :: Type -> Type). StdUniform Float -> RVarT n Float Source #
Distribution StdUniform Int Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: StdUniform Int -> RVar Int Source # rvarT :: forall (n :: Type -> Type). StdUniform Int -> RVarT n Int Source #
Distribution StdUniform Word Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: StdUniform Word -> RVar Word Source # rvarT :: forall (n :: Type -> Type). StdUniform Word -> RVarT n Word Source #
PDF StdUniform Double Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods pdf :: StdUniform Double -> Double -> Double Source # logPdf :: StdUniform Double -> Double -> Double Source #
PDF StdUniform Float Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods pdf :: StdUniform Float -> Float -> Double Source # logPdf :: StdUniform Float -> Float -> Double Source #
HasResolution r => CDF StdUniform (Fixed r) Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods cdf :: StdUniform (Fixed r) -> Fixed r -> Double Source #
HasResolution r => Distribution StdUniform (Fixed r) Source # |
Instance details Defined in Data.Random.Distribution.Uniform Methods rvar :: StdUniform (Fixed r) -> RVar (Fixed r) Source # rvarT :: forall (n :: Type -> Type). StdUniform (Fixed r) -> RVarT n (Fixed r) Source #

stdUniform :: Distribution StdUniform a => RVar a Source #

Get a "standard" uniformly distributed variable. For integral types, this means uniformly distributed over the full range of the type (there is no support for `Integer`). For fractional types, this means uniformly distributed on the interval [0,1).

stdUniformT :: forall a (m :: Type -> Type). Distribution StdUniform a => RVarT m a Source #

Get a "standard" uniformly distributed process. For integral types, this means uniformly distributed over the full range of the type (there is no support for `Integer`). For fractional types, this means uniformly distributed on the interval [0,1).

stdUniformPos :: (Distribution StdUniform a, Num a, Eq a) => RVar a Source #

Like `stdUniform` but only returns positive values.

stdUniformPosT :: forall a (m :: Type -> Type). (Distribution StdUniform a, Num a, Eq a) => RVarT m a Source #

Like `stdUniform` but only returns positive values.

integralUniform :: forall a (m :: Type -> Type). UniformRange a => a -> a -> RVarT m a Source #

Compute a random `Integral` value between the 2 values provided (inclusive).

realFloatUniform :: forall a (m :: Type -> Type). RealFloat a => a -> a -> RVarT m a Source #

`realFloatUniform a b` computes a uniform random value in the range [a,b) for any `RealFloat` type

floatUniform :: forall (m :: Type -> Type). Float -> Float -> RVarT m Float Source #

`floatUniform a b` computes a uniform random `Float` value in the range [a,b)

doubleUniform :: forall (m :: Type -> Type). Double -> Double -> RVarT m Double Source #

`doubleUniform a b` computes a uniform random `Double` value in the range [a,b)

fixedUniform :: forall r (m :: Type -> Type). HasResolution r => Fixed r -> Fixed r -> RVarT m (Fixed r) Source #

`fixedUniform a b` computes a uniform random `Fixed` value in the range [a,b), with any desired precision.

enumUniform :: forall a (m :: Type -> Type). Enum a => a -> a -> RVarT m a Source #

`realFloatUniform a b` computes a uniform random value in the range [a,b) for any `Enum` type

boundedStdUniform :: (Distribution Uniform a, Bounded a) => RVar a Source #

Compute a random value for a `Bounded` type, between `minBound` and `maxBound` (inclusive for `Integral` or `Enum` types, in [`minBound`, `maxBound`) for Fractional types.)

boundedEnumStdUniform :: forall a (m :: Type -> Type). (Enum a, Bounded a) => RVarT m a Source #

Compute a random value for a `Bounded` `Enum` type, between `minBound` and `maxBound` (inclusive)

realFloatStdUniform :: forall a (m :: Type -> Type). RealFloat a => RVarT m a Source #

Compute a uniform random value in the range [0,1) for any `RealFloat` type

fixedStdUniform :: forall r (m :: Type -> Type). HasResolution r => RVarT m (Fixed r) Source #

Compute a uniform random `Fixed` value in the range [0,1), with any desired precision.

floatStdUniform :: forall (m :: Type -> Type). RVarT m Float Source #

Compute a uniform random `Float` value in the range [0,1)

doubleStdUniform :: forall (m :: Type -> Type). RVarT m Double Source #

Compute a uniform random `Double` value in the range [0,1)

boundedStdUniformCDF :: (CDF Uniform a, Bounded a) => a -> Double Source #

realStdUniformCDF :: Real a => a -> Double Source #

The CDF of the random variable `realFloatStdUniform`.

realUniformCDF :: RealFrac a => a -> a -> a -> Double Source #

`realUniformCDF a b` is the CDF of the random variable `realFloatUniform a b`.

enumUniformCDF :: (Enum a, Ord a) => a -> a -> a -> Double Source #