Hoogle Search

Within LTS Haskell 24.2 (ghc-9.10.2)

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

  1. randomInt :: PureMT -> (Int, PureMT)

    mersenne-random-pure64 System.Random.Mersenne.Pure64

    Yield a new Int value from the generator, returning a new generator and that Int. The full 64 bits will be used on a 64 bit machine.

  2. randomInt64 :: PureMT -> (Int64, PureMT)

    mersenne-random-pure64 System.Random.Mersenne.Pure64

    Yield a new Int64 value from the generator, returning a new generator and that Int64.

  3. randomWord :: PureMT -> (Word, PureMT)

    mersenne-random-pure64 System.Random.Mersenne.Pure64

    Yield a new Word value from the generator, returning a new generator and that Word.

  4. randomWord64 :: PureMT -> (Word64, PureMT)

    mersenne-random-pure64 System.Random.Mersenne.Pure64

    Yield a new Word64 value from the generator, returning a new generator and that Word64.

  5. randomIO :: MTRandom a => IO a

    mersenne-random System.Random.Mersenne

    A variant of random that uses the global random number generator (see System.Random#globalrng). Essentially a convenience function if you're already in IO. Note that there are performance penalties calling randomIO in an inner loop, rather than random applied to a global generator. The cost comes in retrieving the random gen from an IORef, which is non-trivial. Expect a 3x slow down in speed of random generation.

  6. randoms :: MTRandom a => MTGen -> IO [a]

    mersenne-random System.Random.Mersenne

    Plural variant of random, producing an infinite list of random values instead of returning a new generator.

  7. class RandomGen g

    random System.Random

    RandomGen is an interface to pure pseudo-random number generators. StdGen is the standard RandomGen instance provided by this library.

  8. class (RandomGen r, StatefulGen g m) => RandomGenM g r (m :: Type -> Type) | g -> r

    random System.Random.Stateful

    Interface to operations on RandomGen wrappers like IOGenM and StateGenM.

  9. class RandomGen g

    tf-random System.Random.TF.Gen

    Alternative RandomGen class with a modified next operation, and added splitn and level operations. Using the generator requires that no more than one operation is called on the same generator state, as the implementation does not guarantee pseudorandomness otherwise. As an exception, calling splitn many times on the same generator state is allowed as long as the 'bits' argument is the same for all the calls.

  10. getStdRandom :: MonadIO m => (StdGen -> (a, StdGen)) -> m a

    random System.Random

    Uses the supplied function to get a value from the current global random generator, and updates the global generator with the new generator returned by the function. For example, rollDice produces a pseudo-random integer between 1 and 6:

    >>> rollDice = getStdRandom (randomR (1, 6))
    
    >>> replicateM 10 (rollDice :: IO Int)
    [5,6,6,1,1,6,4,2,4,1]
    
    This is an outdated function and it is recommended to switch to its equivalent applyAtomicGen instead, possibly with the globalStdGen if relying on the global state is acceptable.
    >>> import System.Random.Stateful
    
    >>> rollDice = applyAtomicGen (uniformR (1, 6)) globalStdGen
    
    >>> replicateM 10 (rollDice :: IO Int)
    [4,6,1,1,4,4,3,2,1,2]
    

Page 3 of many | Previous | Next