mealy-0.4.5.0: Mealy machines for processing time-series and ordered data.
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.Mealy.Simulate

Description

simulation to support testing of Mealy's using mwc-probability

Synopsis

Documentation

rvs :: Gen (PrimState IO) -> Int -> IO [Double] Source #

rvs creates a list of standard normal random variates.

>>> import Data.Mealy
>>> import Data.Mealy.Simulate
>>> gen <- create
>>> rvs gen 3
[1.8005943761746166e-2,0.36444481359059255,-1.2939898115295387]
>>> rs <- rvs gen 10000
>>> fold (ma 1) rs
1.29805301109162e-2
>>> fold (std 1) rs
1.0126527176272948

rvsp :: Gen (PrimState IO) -> Int -> Double -> IO [(Double, Double)] Source #

rvsPair generates a list of correlated random variate tuples

>>> rvsp gen 3 0.8
[(1.8005943761746166e-2,7.074509906249835e-2),(0.36444481359059255,-0.7073208451897444),(-1.2939898115295387,-0.643930709405127)]
>>> rsp <- rvsp gen 10000 0.8
>>> fold (corr (ma 1) (std 1)) rsp
0.8050112742986588

create :: PrimMonad m => m (Gen (PrimState m)) #

Create a generator for variates using a fixed seed.