Ticket #7361: Test3.hs

File Test3.hs, 460 bytes (added by bgamari, 15 months ago)

Test case using only mwc-random

Line 
1import Control.Monad (replicateM, forM)
2import System.Random.MWC
3import Data.Word
4
5withSystemRandomIO :: (GenIO -> IO a) -> IO a         
6withSystemRandomIO = withSystemRandom                   
7
8main = do
9    -- Works as it uses uniform2
10    bs <- withSystemRandomIO $ \mwc -> replicateM 10 $ uniform mwc
11    print (bs :: [Int])
12
13    -- Fails as it uses uniform1
14    bs' <- withSystemRandomIO $ \mwc -> replicateM 10 $ uniform mwc
15    print (bs' :: [Word8])