Permalink
Browse files

Minor: using unsafeDupablePerformIO to be more fair to MWC.

  • Loading branch information...
1 parent 290fc9f commit aaae8071cb1b9db87643ccfb786fc88033025ef9 @rrnewton rrnewton committed Jun 27, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 Benchmark/SimpleRNGBench.hs
@@ -36,7 +36,8 @@ import BinSearch
import System.Random.Mersenne.Pure64
import System.Random.MWC
import Control.Monad.Primitive
-import System.IO.Unsafe
+-- import System.IO.Unsafe
+import GHC.IO
#endif
----------------------------------------------------------------------------------------------------
@@ -117,7 +118,8 @@ data MWCRNG = MWCRNG (Gen (PrimState IO))
-- data MWCRNG = MWCRNG GenIO
instance RandomGen MWCRNG where
-- For testing purposes we hack this to be non-monadic:
- next g@(MWCRNG gen) = unsafePerformIO $
+-- next g@(MWCRNG gen) = unsafePerformIO $
+ next g@(MWCRNG gen) = unsafeDupablePerformIO $
do v <- uniform gen
return (v, g)
#endif

0 comments on commit aaae807

Please sign in to comment.