File: Run.hs

package info (click to toggle)
haskell-random 1.2.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 296 kB
  • sloc: haskell: 2,696; makefile: 3
file content (14 lines) | stat: -rw-r--r-- 441 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module Spec.Run (runsEqual) where

import Data.Word (Word64)
import System.Random.Stateful

runsEqual :: RandomGen g => g -> IO Bool
runsEqual g = do
  let pureResult = runStateGen_ g uniformM :: Word64
      stResult = runSTGen_ g uniformM :: Word64
  ioGenM <- newIOGenM g
  ioResult <- uniformM ioGenM
  atomicGenM <- newAtomicGenM g
  atomicResult <- uniformM atomicGenM
  return $ all (pureResult ==) [stResult, ioResult, atomicResult]