Skip to content

Commit

Permalink
Handle old and new mwc-random
Browse files Browse the repository at this point in the history
  • Loading branch information
axman6 committed May 3, 2024
1 parent 82ca397 commit 5c13e67
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bench/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,23 @@ import Control.Foldl.Statistics
-- Test sample
{-# NOINLINE sample #-}
sample :: U.Vector Double
#if MIN_VERSION_mwc_random(0,15,0)
sample = runST $ do
g <- create
U.replicateM 10000 (uniformRM (-10.0,10.0) g)
#else
sample = runST $ flip uniformVector 10000 =<< create
#endif

{-# NOINLINE sample2 #-}
sample2 :: U.Vector (Double,Double)
#if MIN_VERSION_mwc_random(0,15,0)
sample2 = runST $ do
g <- create
U.replicateM 10000 (liftA2 (,) (uniformRM (-10.0,10.0) g) (uniformRM (0.2,5.0) g))
#else
sample2 = runST $ flip uniformVector 10000 =<< create
#endif

{-# NOINLINE absSample #-}
absSample :: U.Vector Double
Expand Down

0 comments on commit 5c13e67

Please sign in to comment.