miso
Copyright(C) 2016-2025 David M. Johnson
LicenseBSD3-style (see the file LICENSE)
MaintainerDavid M. Johnson <code@dmj.io>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Miso.Random

Description

A PRNG for use in Component and the Component test infrastructure.

Uses the splitmix32 algorithm under the hood.

Synopsis

Types

newtype StdGen Source #

StdGen holds a JS Function.

Constructors

StdGen Function 

type Seed = Int Source #

An initial Seed value, useful for simulations or reproducing test failures

Functions

newStdGen :: IO StdGen Source #

Create a new StdGen, defaulting to a random Seed.

mkStdGen :: Seed -> StdGen Source #

Like newStdGen but takes a Seed as an argument and is pure.

next :: StdGen -> (Double, StdGen) Source #

Get the next StdGen, extracting the value, useful with State.

replicateRM :: Int -> IO [Double] Source #

Generate n amount of random numbers. Uses the global PRNG globalStdGen.

replicateRM 10 :: IO [Double]

Globals

globalStdGen :: IORef StdGen Source #

Global StdGen, used by replicateRM and others.