Hoogle Search

Within LTS Haskell 24.38 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. class UniformRange a

    mwc-random System.Random.MWC

    The class of types for which a uniformly distributed value can be drawn from a range.

  2. uniform :: (Variate a, PrimMonad m) => Gen (PrimState m) -> m a

    mwc-random System.Random.MWC

    Generate a single uniformly distributed random variate. The range of values produced varies by type:

    • For fixed-width integral types, the type's entire range is used.
    • For floating point numbers, the range (0,1] is used. Zero is explicitly excluded, to allow variates to be used in statistical calculations that require non-zero values (e.g. uses of the log function).
    To generate a Float variate with a range of [0,1), subtract 2**(-33). To do the same with Double variates, subtract 2**(-53).

  3. uniformM :: (Uniform a, StatefulGen g m) => g -> m a

    mwc-random System.Random.MWC

    Generates a value uniformly distributed over all possible values of that type. There is a default implementation via Generic:

    >>> :set -XDeriveGeneric -XDeriveAnyClass
    
    >>> import GHC.Generics (Generic)
    
    >>> import System.Random.Stateful
    
    >>> data MyBool = MyTrue | MyFalse deriving (Show, Generic, Finite, Uniform)
    
    >>> data Action = Code MyBool | Eat (Maybe Bool) | Sleep deriving (Show, Generic, Finite, Uniform)
    
    >>> gen <- newIOGenM (mkStdGen 42)
    
    >>> uniformListM 10 gen :: IO [Action]
    [Code MyTrue,Code MyTrue,Eat Nothing,Code MyFalse,Eat (Just False),Eat (Just True),Eat Nothing,Eat (Just False),Sleep,Code MyFalse]
    

  4. uniformR :: (Variate a, PrimMonad m) => (a, a) -> Gen (PrimState m) -> m a

    mwc-random System.Random.MWC

    Generate single uniformly distributed random variable in a given range.

    • For integral types inclusive range is used.
    • For floating point numbers range (a,b] is used if one ignores rounding errors.

  5. uniformRM :: (UniformRange a, StatefulGen g m) => (a, a) -> g -> m a

    mwc-random System.Random.MWC

    Generates a value uniformly distributed over the provided range, which is interpreted as inclusive in the lower and upper bound.

    • uniformRM (1 :: Int, 4 :: Int) generates values uniformly from the set <math>
    • uniformRM (1 :: Float, 4 :: Float) generates values uniformly from the set <math>
    The following law should hold to make the function always defined:
    uniformRM (a, b) = uniformRM (b, a)
    

  6. uniformVector :: (PrimMonad m, StatefulGen g m, Uniform a, Vector v a) => g -> Int -> m (v a)

    mwc-random System.Random.MWC

    Generate a vector of pseudo-random variates. This is not necessarily faster than invoking uniform repeatedly in a loop, but it may be more convenient to use in some situations.

  7. uniformPermutation :: (StatefulGen g m, PrimMonad m, Vector v Int) => Int -> g -> m (v Int)

    mwc-random System.Random.MWC.Distributions

    Random variate generator for uniformly distributed permutations. It returns random permutation of vector [0 .. n-1]. This is the Fisher-Yates shuffle

  8. uniformShuffle :: (StatefulGen g m, PrimMonad m, Vector v a) => v a -> g -> m (v a)

    mwc-random System.Random.MWC.Distributions

    Random variate generator for a uniformly distributed shuffle (all shuffles are equiprobable) of a vector. It uses Fisher-Yates shuffle algorithm.

  9. uniformShuffleM :: (StatefulGen g m, PrimMonad m, MVector v a) => v (PrimState m) a -> g -> m ()

    mwc-random System.Random.MWC.Distributions

    In-place uniformly distributed shuffle (all shuffles are equiprobable)of a vector.

  10. prologueBefore :: Prologue -> [Miscellaneous]

    xml-conduit Text.XML

    No documentation available.

Page 504 of many | Previous | Next