File: Initialization.hs

package info (click to toggle)
haskell-splitmix 0.1.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 200 kB
  • sloc: haskell: 1,337; ansic: 125; sh: 53; makefile: 3
file content (28 lines) | stat: -rw-r--r-- 806 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module Main (main) where

import Control.Monad (forM_, replicateM)
import Data.List     (tails)
import Test.HUnit    (assertFailure)

import qualified System.Random.SplitMix   as SM
import qualified System.Random.SplitMix32 as SM32

main :: IO ()
main = do
    g64 <- replicateM 10 (fmap show SM.initSMGen)
    putStrLn $ unlines g64
    forM_ (tails g64) $ \xs' -> case xs' of
        []     -> return ()
        (x:xs) ->
            if all (x /=) xs
            then return ()
            else assertFailure "ERROR: duplicate"

    g32 <- replicateM 10 (fmap show SM32.initSMGen)
    putStrLn $ unlines g32
    forM_ (tails g32) $ \xs' -> case xs' of
        []     -> return ()
        (x:xs) ->
            if all (x /=) xs
            then return ()
            else assertFailure "ERROR: duplicate"