random is:module

This library deals with the common task of pseudo-random number generation.
This module is provided for backwards compatibility, and simply re-exports Control.Monad.Random.Lazy.
Random monads, passing a random number generator through a computation. This version is lazy; for a strict version, see Control.Monad.Trans.Random.Strict, which has the same interface.
PRNG services See http://www.openssl.org/docs/crypto/rand.html For random Integer generation, see OpenSSL.BN
This module is for instantiating cryptographicly strong determinitic random bit generators (DRBGs, aka PRNGs) For the simple use case of using the system random number generator (Entropy) to seed the DRBG:
g <- newGenIO
Users needing to provide their own entropy can call newGen directly
entropy <- getEntropy nrBytes
let generator = newGen entropy
Flexible modeling and sampling of random variables. The central abstraction in this library is the concept of a random variable. It is not fully formalized in the standard measure-theoretic language, but rather is informally defined as a "thing you can get random values out of". Different random variables may have different types of values they can return or the same types but different probabilities for each value they can return. The random values you get out of them are traditionally called "random variates". Most imperative-language random number libraries are all about obtaining and manipulating random variates. This one is about defining, manipulating and sampling random variables. Computationally, the distinction is small and mostly just a matter of perspective, but from a program design perspective it provides both a powerfully composable abstraction and a very useful separation of concerns. Abstract random variables as implemented by RVar are composable. They can be defined in a monadic / "imperative" style that amounts to manipulating variates, but with strict type-level isolation. Concrete random variables are also provided, but they do not compose as generically. The Distribution type class allows concrete random variables to "forget" their concreteness so that they can be composed. For examples of both, see the documentation for RVar and Distribution, as well as the code for any of the concrete distributions such as Uniform, Gamma, etc. Both abstract and concrete random variables can be sampled (despite the types GHCi may list for the functions) by the functions in Data.Random.Sample. Random variable sampling is done with regard to a generic basis of primitive random variables defined in Data.Random.Internal.Primitives. This basis is very low-level and the actual set of primitives is still fairly experimental, which is why it is in the "Internal" sub-heirarchy. User-defined variables should use the existing high-level variables such as Uniform and Normal rather than these basis variables. Data.Random.Source defines classes for entropy sources that provide implementations of these primitive variables. Several implementations are available in the Data.Random.Source.* modules.
GHC.Generics-based arbitrary generators.

Basic usage

{-# LANGUAGE DeriveGeneric #-}

data Foo = A | B | C  -- some generic data type
deriving Generic
Derive instances of Arbitrary.
instance Arbitrary Foo where
arbitrary = genericArbitrary uniform  -- Give a distribution of constructors.
shrink = genericShrink  -- Generic shrinking is provided by the QuickCheck library.
Or derive standalone generators (the fields must still be instances of Arbitrary, or use custom generators).
genFoo :: Gen Foo
genFoo = genericArbitrary uniform

Using DerivingVia

{-# LANGUAGE DerivingVia, TypeOperators #-}

data Foo = A | B | C
deriving Generic
deriving Arbitrary via (GenericArbitraryU `AndShrinking` Foo)
For more information:
Signals and signal functions with noise and randomness. The Random number generators are re-exported from System.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.
Create ClSFs with randomness without IO. Uses the MonadRandom package. This module copies the API from automaton's Random.
An Automatons in a monad supporting random number generation (i.e. having the RandT layer in its stack) can be run. Running means supplying an initial random number generator, where the update of the generator at every random number generation is already taken care of. Under the hood, RandT is basically just StateT, with the current random number generator as mutable state.
In this module, MSFs in a monad supporting random number generation (i.e. having the RandT layer in its stack) can be run. Running means supplying an initial random number generator, where the update of the generator at every random number generation is already taken care of. Under the hood, RandT is basically just StateT, with the current random number generator as mutable state.
Representation of probabilities and random computations.
Randomized values
Functions to generate random trees and nodes.
TextShow instances for StdGen. Since: 2
Helper functions to generate the random part of an ULID either with PRNGs or TRNGs.
Throughout the module an undirected graph is a directed graph that is symmetric and irreflexive.