HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulefoundation-0.0.30Haskell2010

Foundation.Random

This module deals with the random subsystem abstractions.

It provide 2 different set of abstractions:

  • The first abstraction that allow a monad to generate random through the MonadRandom class.

  • The second abstraction to make generic random generator RandomGen and a small State monad like wrapper MonadRandomState to abstract a generator.

  • 3 types
  • 2 classes
  • 1 value
  • Packagefoundation-0.0.30
  • Exports6
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceRandom.hs
classclass RandomGen gen where
#

A Deterministic Random Generator (DRG) class

Methods

Instances2RandomGen
  • RandomGen StateDefined in foundation-0.0.30 · Foundation.Random.ChaChaDRG
  • RandomGen StateDefined in foundation-0.0.30 · Foundation.Random.XorShift
newtypenewtype MonadRandomState gen a
#

A simple Monad class very similar to a State Monad with the state being a RandomGenerator.

Constructors

Instances4Monad, Functor, Applicative, MonadRandom
typetype RNG = RNGv1
#

An alias to the default choice of deterministic random number generator

Unless, you want to have the stability of a specific random number generator, e.g. for tests purpose, it's recommended to use this alias so that you would keep up to date with possible bugfixes, or change of algorithms.