mwc-random-monad 0.6 → 0.7
raw patch · 2 files changed
+31/−2 lines, 2 filesdep ~mwc-randomPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: mwc-random
API changes (from Hackage documentation)
+ System.Random.MWC.Distributions.Monad: geometric0 :: MonadPrim m => Double -> Rand m Int
+ System.Random.MWC.Distributions.Monad: geometric1 :: MonadPrim m => Double -> Rand m Int
+ System.Random.MWC.Distributions.Monad: truncatedExp :: MonadPrim m => Double -> (Double, Double) -> Rand m Double
- System.Random.MWC.CondensedTable.Monad: tableFromProbabilities :: (Vector v (a, Word32), Vector v (a, Double), Vector v a, Vector v Word32, Show a) => v (a, Double) -> CondensedTable v a
+ System.Random.MWC.CondensedTable.Monad: tableFromProbabilities :: (Vector v (a, Word32), Vector v (a, Double), Vector v a, Vector v Word32) => v (a, Double) -> CondensedTable v a
- System.Random.MWC.CondensedTable.Monad: tableFromWeights :: (Vector v (a, Word32), Vector v (a, Double), Vector v a, Vector v Word32, Show a) => v (a, Double) -> CondensedTable v a
+ System.Random.MWC.CondensedTable.Monad: tableFromWeights :: (Vector v (a, Word32), Vector v (a, Double), Vector v a, Vector v Word32) => v (a, Double) -> CondensedTable v a
Files
System/Random/MWC/Distributions/Monad.hs view
@@ -12,8 +12,11 @@ normal , standard , exponential+ , truncatedExp , gamma , chiSquare+ , geometric0+ , geometric1 ) where import Control.Monad.Primitive.Class (MonadPrim(..))@@ -43,6 +46,15 @@ exponential x = toRand $ \g -> MWC.exponential x g {-# INLINE exponential #-} +-- | Generate truncated exponentially distributed random variate.+truncatedExp :: MonadPrim m+ => Double -- ^ Scale parameter+ -> (Double,Double) -- ^ Range to which distribution is+ -- truncated. Values may be negative.+ -> Rand m Double+truncatedExp s rng = toRand $ \g -> MWC.truncatedExp s rng g+{-# INLINE truncatedExp #-}+ -- | Random variate generator for gamma distribution. gamma :: MonadPrim m => Double -- ^ Shape parameter@@ -57,3 +69,20 @@ -> Rand m Double chiSquare n = toRand $ \g -> MWC.chiSquare n g {-# INLINE chiSquare #-}++-- | Random variate generator for the geometric distribution,+-- computing the number of failures before success. Distribution's+-- support is [0..].+geometric0 :: MonadPrim m+ => Double -- ^ /p/ success probability lies in (0,1]+ -> Rand m Int+geometric0 p = toRand $ \g -> MWC.geometric0 p g+{-# INLINE geometric0 #-}++-- | Random variate generator for geometric distribution for number of+-- trials. Distribution's support is [1..] (i.e. just 'geometric0' shifted by 1).+geometric1 :: MonadPrim m+ => Double -- ^ /p/ success probability lies in (0,1]+ -> Rand m Int+geometric1 p = toRand $ \g -> MWC.geometric1 p g+{-# INLINE geometric1 #-}
mwc-random-monad.cabal view
@@ -1,5 +1,5 @@ Name: mwc-random-monad-Version: 0.6+Version: 0.7 License: BSD3 License-file: LICENSE Author: Alexey Khudyakov <alexey.skladnoy@gmail.com>@@ -19,7 +19,7 @@ primitive, monad-primitive, vector >= 0.7,- mwc-random >= 0.11+ mwc-random >= 0.13 Exposed-modules: System.Random.MWC.Monad System.Random.MWC.Distributions.Monad