HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Modulepcg-random-0.1.4.0Haskell2010

System.Random.PCG.Class

Classes for working with random numbers along with utility functions. In a future release this module may disappear and use another module for this functionality.

Contents
  1. Classes
  2. Type restricted versions
  3. uniform
  4. uniformR
  5. uniformB
  6. Utilities
Synopsis

Classes

classclass Monad m => Generator g (m :: Type -> Type) where
#

Methods

Instances6Generator
classclass Variate a where
#

Methods

  • uniform :: Generator g m => g -> m a

    Generate a uniformly distributed random vairate.

    • Use entire range for integral types.

    • Use (0,1] range for floating types.

  • uniformR :: Generator g m => (a, a) -> g -> m a

    Generate a uniformly distributed random vairate in the given range.

    • Use inclusive range for integral types.

    • Use (a,b] range for floating types.

  • uniformB :: Generator g m => a -> g -> m a

    Generate a uniformly distributed random vairate in the range [0,b). For integral types the bound must be less than the max bound of Word32 (4294967295). Behaviour is undefined for negative bounds.

Instances16Variate, …
  • Variate Int16Defined in pcg-random-0.1.4.0 · System.Random.PCG.Class
  • Variate Int32Defined in pcg-random-0.1.4.0 · System.Random.PCG.Class
  • Variate Int64Defined in pcg-random-0.1.4.0 · System.Random.PCG.Class
  • Variate Int8Defined in pcg-random-0.1.4.0 · System.Random.PCG.Class
  • Variate BoolDefined in pcg-random-0.1.4.0 · System.Random.PCG.Class
  • Variate DoubleDefined in pcg-random-0.1.4.0 · System.Random.PCG.Class
  • Variate FloatDefined in pcg-random-0.1.4.0 · System.Random.PCG.Class
  • Variate IntDefined in pcg-random-0.1.4.0 · System.Random.PCG.Class
  • Variate WordDefined in pcg-random-0.1.4.0 · System.Random.PCG.Class
  • Variate Word16Defined in pcg-random-0.1.4.0 · System.Random.PCG.Class
  • Variate Word32Defined in pcg-random-0.1.4.0 · System.Random.PCG.Class
  • Variate Word64Defined in pcg-random-0.1.4.0 · System.Random.PCG.Class
  • Variate Word8Defined in pcg-random-0.1.4.0 · System.Random.PCG.Class
  • (Variate a, Variate b) => Variate (a, b)Defined in pcg-random-0.1.4.0 · System.Random.PCG.Class
  • (Variate a, Variate b, Variate c) => Variate (a, b, c)Defined in pcg-random-0.1.4.0 · System.Random.PCG.Class
  • (Variate a, Variate b, Variate c, Variate d) => Variate (a, b, c, d)Defined in pcg-random-0.1.4.0 · System.Random.PCG.Class

Type restricted versions

uniform

uniformR

uniformB

Utilities

familytype family Unsigned a
#
Instances10Unsigned, …

Generate a random number using System.Entropy.

Use RDRAND if available and XOR with /dev/urandom on Unix and CryptAPI on Windows. This entropy is considered cryptographically secure but not true entropy.