Hoogle Search

Within LTS Haskell 24.40 (ghc-9.10.3)

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

  1. uniformR :: (RandomGen g, UniformRange a) => (a, a) -> g -> (a, g)

    random System.Random

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

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

    Examples

    >>> import System.Random
    
    >>> let pureGen = mkStdGen 137
    
    >>> uniformR (1 :: Int, 4 :: Int) pureGen
    (4,StdGen {unStdGen = SMGen 11285859549637045894 7641485672361121627})
    

  2. class Uniform a

    random System.Random.Stateful

    The class of types for which a uniformly distributed value can be drawn from all possible values of the type.

  3. class UniformRange a

    random System.Random.Stateful

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

  4. uniformByteStringM :: StatefulGen g m => Int -> g -> m ByteString

    random System.Random.Stateful

    Generates a pseudo-random ByteString of the specified size.

  5. uniformDouble01M :: StatefulGen g m => g -> m Double

    random System.Random.Stateful

    Generates uniformly distributed Double in the range <math>. Numbers are generated by generating uniform Word64 and dividing it by <math>. It's used to implement UniformRange instance for Double.

  6. uniformDoublePositive01M :: StatefulGen g m => g -> m Double

    random System.Random.Stateful

    Generates uniformly distributed Double in the range <math>. Number is generated as <math>. Constant is 1/2 of smallest nonzero value which could be generated by uniformDouble01M.

  7. uniformEnumM :: (Enum a, Bounded a, StatefulGen g m) => g -> m a

    random System.Random.Stateful

    Generates uniformly distributed Enum. One can use it to define a Uniform instance:

    data Colors = Red | Green | Blue deriving (Enum, Bounded)
    instance Uniform Colors where uniformM = uniformEnumM
    

  8. uniformEnumRM :: (Enum a, StatefulGen g m) => (a, a) -> g -> m a

    random System.Random.Stateful

    Generates uniformly distributed Enum in the given range. One can use it to define a UniformRange instance:

    data Colors = Red | Green | Blue deriving (Enum)
    instance UniformRange Colors where
    uniformRM = uniformEnumRM
    inInRange (lo, hi) x = isInRange (fromEnum lo, fromEnum hi) (fromEnum x)
    

  9. uniformFloat01M :: StatefulGen g m => g -> m Float

    random System.Random.Stateful

    Generates uniformly distributed Float in the range <math>. Numbers are generated by generating uniform Word32 and dividing it by <math>. It's used to implement UniformRange instance for Float.

  10. uniformFloatPositive01M :: StatefulGen g m => g -> m Float

    random System.Random.Stateful

    Generates uniformly distributed Float in the range <math>. Number is generated as <math>. Constant is 1/2 of smallest nonzero value which could be generated by uniformFloat01M.

Page 412 of many | Previous | Next