-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Easy and reasonably efficient probabilistic programming and random generation -- -- Easy and reasonably efficient probabilistic programming and random -- generation -- -- This library gives a common language to speak about probability -- distributions and random generation, by wrapping both, when necessary, -- in a RandT monad defined in Math.Probable.Random. This -- module also provides a lot of useful little combinators for easily -- describing how random values for your types should be generated. -- -- In Math.Probable.Distribution, you'll find functions for -- generating random values that follow any distribution supported by -- mwc-random. -- -- In Math.Probable.Distribution.Finite, you'll find an -- adaptation of Eric Kidd's work on probability monads (from -- here). -- -- You may want to check the examples bundled with this package, viewable -- online at -- https://github.com/alpmestan/probable/tree/master/examples. One -- of these examples is simple enough to be worth reproducing here. -- --
--   module Main where
--   
--   import Control.Applicative
--   import Control.Monad
--   import Math.Probable
--   
--   import qualified Data.Vector.Unboxed as VU
--   
--   data Person = Person Int    -- ^ age
--                        Double -- ^ weight (kgs)
--                        Double -- ^ salary (e.g euros)
--       deriving (Eq, Show)
--   
--   person :: RandT IO Person
--   person =
--       Person <$> uniformIn (1, 100)
--              <*> uniformIn (2, 130)
--              <*> uniformIn (500, 10000)
--   
--   randomPersons :: Int -> IO [Person]
--   randomPersons n = mwc $ listOf n person
--   
--   randomDoubles :: Int -> IO (VU.Vector Double)
--   randomDoubles n = mwc $ vectorOf n double
--   
--   main :: IO ()
--   main = do
--       randomPersons 10 >>= mapM_ print
--       randomDoubles 10 >>= VU.mapM_ print
--   
-- -- Please report any feature request or problem, either by email or -- through github's issues/feature requests. @package probable @version 0.1.3 -- | Random number generation based on Gen, defined as a Monad -- transformer. -- -- Quickstart, in ghci: -- --
--   λ> import Math.Probable
--   λ> import Control.Applicative
--   λ> mwc double
--   0.2756820707828763
--   λ> mwc word64
--   12175918187293541909
--   λ> mwc $ (,) <$> bool <*> intIn (0, 10)
--   (True,7)
--   λ> mwc $ do { n <- intIn (1, 10) ; listOf n (listOf 2 bool) }
--   [ [False,True],[True,False],[False,True],[False,False],[False,False],
--     [False,True],[True,False],[True,False],[True,True],[False,False]
--   ]
--   
-- -- This module features a bunch of combinators that can help you create -- some random generation descriptions easily, and in a very familiar -- style. -- -- You can easily combine them through the Monad instance for -- RandT which really just make sure everyone gets a Gen -- (from mwc-random) eventually. This of course makes RandT a -- Functor and an Applicative. -- --
--   import Math.Probable
--   
--   data Person = 
--     Person { name   :: String
--            , age    :: Int
--            , salary :: Double
--            }
--       deriving (Eq, Show)
--   
--   randomPerson :: PrimMonad m 
--                => RandT m Person
--   randomPerson = do
--       -- we pick a random length
--       -- for the person's name
--       nameLen <- intIn (3, 10) 
--                              
--       -- and just express what a random Person
--       -- should be, Applicative-style
--       Person <$> pickName nameLen    -- pick a name
--              <*> intIn (0, 100)      -- an Int between 0 and 100
--              <*> doubleIn (0, 10000) -- a Double between 0 and 10000
--   
--       where pickName nameLen = do
--                 -- the initial, between 'A' and 'Z'
--                 initial <- chr `fmap` intIn (65, 90)
--    
--                 (initial:) `fmap` 
--                 -- the rest, between 'a' and 'z'
--                     listOf (nameLen - 1)
--                            (chr `fmap` intIn (97, 122))
--   
-- -- This is all nice, but how do we actually sample such a Person? You -- just have to call mwc: -- --
--   λ> mwc randomPerson
--   Person {name = "Ojeesra", age = 83, salary = 3075.9945184521885}
--   
-- -- So any value of type 'RandT m a' is something that you'll eventually -- run in m (hence IO or ST s) for -- generating a random value of type a. Note that -- mwc forces the execution using withSystemRandom and -- gets you back in IO, whereas mwcST gets you back in -- ST s. -- -- My simple name generation routine can help you pick a name for your -- baby, if you are having one soon. -- --
--   λ> map name `fmap` mwc (listOf 10 randomPerson)
--   ["Npujbc","Faidx","Zusha","Ghbipic","Ljaestei","Fktcfonnxe","Hlvkolds","Zpws","Zgmrkrdv","Rhcd"]
--   
-- -- If we were to make a generator that could generate more familiar and -- creativity-free names, we wouldn't sample uniformly from the alphabet. module Math.Probable.Random -- | RandT type, equivalent to a ReaderT (Gen -- (PrimState m)) -- -- This lets you build simple or complex random generation routines -- without having the generator passed all around and just run the whole -- thing in the end, most likely by using mwc. newtype RandT m a RandT :: (Gen (PrimState m) -> m a) -> RandT m a [runRandT] :: RandT m a -> Gen (PrimState m) -> m a -- | Take a RandT value and run it in IO, generating all the -- random values described by the RandT. It just uses -- withSystemRandom so you really should try hard to put your -- whole random generation logic in RandT and call mwc in -- the end, thus initialising the generator only once and generating -- everything with it. -- -- See the documentation for withSystemRandom for more about this. -- --
--   λ> mwc $ (+2) `fmap` int8
--   34
--   
mwc :: RandT IO a -> IO a -- | If for some reason you have a RandT (ST s) you -- can run it from IO just like we do with mwc. -- --
--   λ> mwcST $ listOf 4 bool
--   [False,False,True,True]
--   
mwcST :: RandT (ST s) a -> IO a -- | A generic function for sampling uniformly any type that implements -- Variate. -- -- All the xxxIn functions from this module just call -- uniformR. uniformIn :: (Variate a, PrimMonad m) => (a, a) -> RandT m a -- | Generate a random Int. The whole Int range is used. -- --
--   λ> mwc int
--   8354496680947360541
--   
int :: PrimMonad m => RandT m Int -- | Generate a random Int8. The whole Int8 range is used. -- --
--   λ> mwc int8
--   -65
--   
int8 :: PrimMonad m => RandT m Int8 -- | Generate a random Int16. The whole Int16 range is used. -- --
--   λ> mwc int16
--   15413
--   
int16 :: PrimMonad m => RandT m Int16 -- | Generate a random Int32. The whole Int32 range is used. -- --
--   λ> mwc int32
--   1774441747
--   
int32 :: PrimMonad m => RandT m Int32 -- | Generate a random Int64. The whole Int64 range is used. -- --
--   λ> mwc int64
--   -2596387699802756017
--   
int64 :: PrimMonad m => RandT m Int64 -- | Generate a random Int in the given range. -- --
--   λ> mwc $ intIn (0, 10)
--   7
--   
intIn :: PrimMonad m => (Int, Int) -> RandT m Int -- | Generate a random Int8 in the given range -- --
--   λ> mwc $ int8In (-10, 10)
--   -3
--   
int8In :: PrimMonad m => (Int8, Int8) -> RandT m Int8 -- | Generate a random Int16 in the given range -- --
--   λ> mwc $ int16In (-500, 30129)
--   9501
--   
int16In :: PrimMonad m => (Int16, Int16) -> RandT m Int16 -- | Generate a random Int32 in the given range. -- --
--   λ> mwc $ int32In (-500, 30129)
--   8012
--   
int32In :: PrimMonad m => (Int32, Int32) -> RandT m Int32 -- | Generate a random Int64 in the given range. -- --
--   λ> mwc $ int64In (-2^30, 30)
--   -630614786
--   
int64In :: PrimMonad m => (Int64, Int64) -> RandT m Int64 -- | Generate a random Word. The whole Word range is used. -- --
--   λ> mwc word
--   3106215968599504888
--   
word :: PrimMonad m => RandT m Word -- | Generate a random Word8. The whole Word8 range is used. -- --
--   λ> mwc word8
--   231
--   
word8 :: PrimMonad m => RandT m Word8 -- | Generate a random Word16. The whole Word16 range is -- used. -- --
--   λ> mwc word16
--   31127
--   
word16 :: PrimMonad m => RandT m Word16 -- | Generate a random Word32. The whole Word32 range is -- used. -- --
--   λ> mwc word32
--   3917666696
--   
word32 :: PrimMonad m => RandT m Word32 -- | Generate a random Word64. The whole Word64 range is -- used. -- --
--   λ> mwc word64
--   12496697905424132339
--   
word64 :: PrimMonad m => RandT m Word64 -- | Generate a random Word in the given range. -- --
--   λ> mwc $ wordIn (1, 64)
--   28
--   
wordIn :: PrimMonad m => (Word, Word) -> RandT m Word -- | Generate a random Word8 in the given range -- --
--   λ> mwc $ word8In (2, 15)
--   3
--   
word8In :: PrimMonad m => (Word8, Word8) -> RandT m Word8 -- | Generate a random Word16 in the given range. -- --
--   λ> mwc $ word16In (2^13, 2^14)
--   8885
--   
word16In :: PrimMonad m => (Word16, Word16) -> RandT m Word16 -- | Generate a random Word32 in the given range. -- --
--   λ> mwc $ word32In (100, 330)
--   125
--   
word32In :: PrimMonad m => (Word32, Word32) -> RandT m Word32 -- | Generate a random Word64 in the given range. -- --
--   λ> mwc $ word64In (2^45, 2^46)
--   59226619151303
--   
word64In :: PrimMonad m => (Word64, Word64) -> RandT m Word64 -- | Generate a random Float between 0 (excluded) and 1 (included) -- --
--   λ> mwc float
--   0.11831179
--   
float :: PrimMonad m => RandT m Float -- | Generate a random Double between 0 (excluded) and 1 (included) -- --
--   λ> mwc double
--   0.7689412928620208
--   
double :: PrimMonad m => RandT m Double -- | Generate a random Float in the given range -- --
--   λ> mwc $ floatIn (0.20, 3.14)
--   1.3784513
--   
floatIn :: PrimMonad m => (Float, Float) -> RandT m Float -- | Generate a random Double in the given range -- --
--   λ> mwc $ doubleIn (-30.121121445, 0.129898878612)
--   -13.612464813256999
--   
doubleIn :: PrimMonad m => (Double, Double) -> RandT m Double -- | Generate a random Bool -- --
--   λ> mwc bool
--   False
--   
bool :: PrimMonad m => RandT m Bool -- | Repeatedly run a random computation yielding a value of type -- a to get a list of random values of type a. -- --
--   λ> mwc (listOf 30 float)
--   [ 5.438623e-2,0.78114086,0.4954672,0.5958733,0.47243807,5.883485e-2
--   , 5.500287e-2,0.79262286,0.5528683,0.7628807,0.80705905,0.15368962
--   , 0.8654971,0.4560417,0.23922172,0.5069659,0.8130155,0.6559351
--   , 1.31405e-2,0.25705606,0.7134138,0.79111993,0.7529769,0.10573909
--   , 0.37731406,0.6289338,0.85156864,0.15691182,0.9910314,8.133593e-2
--   ]
--   
-- --
--   λ> mwc (sum `fmap` listOf 30 float)
--   15.037931
--   
listOf :: Monad m => Int -> RandT m a -> RandT m [a] -- | A function for generating a vector of the given length with random -- values of any type (in contrast to vectorOfVariate). -- -- It is generic in the Vector instance it hands you back. It's -- implemented in terms of replicateM and has been benchmarked to -- perform as well as uniformVector on simple types -- (uniformVector can't generate values for types that don't have -- a Variate instance). -- --
--   λ> import qualified Data.Vector.Unboxed as V
--   λ> :set -XScopedTypeVariables
--   λ> v :: V.Vector Int <- mwc $ vectorOf 10 int
--   λ> V.mapM_ print v
--   -3920053790769159788
--   3983393642052845448
--   1528310798822685910
--   3522283620461337684
--   6451017362937898910
--   1929485210691770214
--   8547527164583329795
--   3298785082692387491
--   4019024417224980311
--   -5216301990322376953
--   
vectorOf :: (Monad m, Vector v a) => Int -> RandT m a -> RandT m (v a) -- | A function for generating a vector of the given length for values -- whose types are instances of Variate. -- -- This function is generic in the type of vector it returns, any -- instance of Vector will do. -- -- It's just a wrapper arround uniformVector and doesn't really -- use the Monad instance of RandT. -- -- But if you want to have a vector of Persons, you have to use -- vectorOf. -- --
--   λ> import qualified Data.Vector.Unboxed as V
--   λ> :set -XScopedTypeVariables
--   λ> v :: V.Vector Double <- mwc $ vectorOfVariate 10
--   λ> V.mapM_ print v
--   3.8565084196117705e-2
--   0.575103826646098
--   0.379710162825715
--   0.4066991135077237
--   0.9778431248247549
--   0.3786223745680838
--   0.4361789615081698
--   0.9904407826187301
--   0.2951087330670904
--   0.1533350329892028
--   
vectorOfVariate :: (PrimMonad m, Variate a, Vector v a) => Int -> RandT m (v a) instance GHC.Base.Monad m => GHC.Base.Monad (Math.Probable.Random.RandT m) instance GHC.Base.Monad m => GHC.Base.Functor (Math.Probable.Random.RandT m) instance GHC.Base.Monad m => GHC.Base.Applicative (Math.Probable.Random.RandT m) -- | Fun with finite distributions! -- -- This all pretty much comes from Eric Kidd's series of blog posts at -- http://www.randomhacks.net/probability-monads/. -- -- I have adapted it a bit by making it fit into my own random -- generation/sampling scheme. -- -- The idea and purpose of this module should be clear after going -- through an example. First, let's import the library and -- vector. -- --
--   import Math.Probable
--   import qualified Data.Vector as V
--   
-- -- We are going to talk about Books, and particularly about whether a -- given book is interesting or not. -- --
--   data Book = Interesting 
--             | Boring
--       deriving (Eq, Show)
--   
-- -- Let's say we have very particular tastes, and that we think that only -- 20% of all books are interesting (that's not so small actually. oh -- well). -- --
--   bookPrior :: Finite d => d Book
--   bookPrior = weighted [ (Interesting, 0.2) 
--                        , (Boring, 0.8) 
--                        ]
--   
-- -- weighted belongs to the Finite class, which represents -- types that can somehow represent a distribution over a finite set. -- That makes our distribution polymorphic in how we will use it. -- Awesome! -- -- So how does it look? -- --
--   λ> exact bookPrior -- in ghci
--   [Event Interesting 20.0%,Event Boring 80.0%]
--   
-- -- exact takes Fin a and gives you the inner list -- that Fin uses to represent the distribution. -- -- Now, what if we pick two books? First, how do we even do that? Well, -- any instance of Finite must be a Monad, so you have your -- good old do notation. The ones provided by this package also -- provide Functor and Applicative instances, but let's use -- do. -- --
--   twoBooks :: Finite d => d (Book, Book)
--   twoBooks = do
--       book1 <- bookPrior
--       book2 <- bookPrior
--       return (book1, book2)
--   
-- -- Nothing impressive. We pick a book with the prior we defined above, -- then another, pair them together and hand the pair back. What this -- will actually do is behave just like in the list monad, but in -- addition to this it will combine the probabilities of the various -- events we could be dealing with in the appropriate way. -- -- So, how about we verify what I just said: -- --
--   λ> exact twoBooks
--   [ Event (Interesting,Interesting) 4.0%
--   , Event (Interesting,Boring) 16.0%
--   , Event (Boring,Interesting) 16.0%
--   , Event (Boring,Boring) 64.0%
--   ]
--   
-- -- Nice! Let's take a look at a more complicated scenario now. -- -- What if we wanted to take a look at the same distribution, with just a -- difference: we want at least one of the books to be an Interesting -- one. -- --
--   oneInteresting :: Fin (Book, Book)
--   oneInteresting = bayes $ do -- notice the call to bayes
--       (b1, b2) <- twoBooks
--       condition (b1 == Interesting || b2 == Interesting)
--       return (b1, b2)
--   
-- -- We get two books from the previous distribution, and use -- condition to restrict the current distribution to the values of -- b1 and b2 that verify our condition. This lifts us in the -- FinBayes type, where our probabilistic computations can "fail" -- in some sense. If you want to discard values and restrict the ones on -- which you'll run further computations, use condition. -- -- However, how do we view the distribution now, without having all those -- Maybes in the middle? That's what bayes is for. It runs -- the computations for the distribution and discards all the ones where -- any condition wasn't satisfied. In particular, it means it -- hands you back a normal Fin distribution. -- -- If we run this one: -- --
--   λ> exact oneInteresting
--   [ Event (Interesting,Interesting) 11.1%
--   , Event (Interesting,Boring) 44.4%
--   , Event (Boring,Interesting) 44.4%
--   ]
--   
-- -- Note that these finite distribution types support random sampling too: -- -- -- --
--   -- example of the former
--   sampleBooks :: RandT IO (V.Vector Book)
--   sampleBooks = vectorOf 10 bookPrior
--   
-- --
--   λ> mwc sampleBooks
--   fromList [Interesting,Boring,Boring,Boring,Boring
--            ,Boring,Boring,Interesting,Boring,Boring]
--   
-- --
--   λ> mwc $ listOf 4 (liftF oneInteresting) -- example of the latter
--   [ (Boring,Interesting)
--   , (Boring,Interesting)
--   , (Boring,Interesting)
--   , (Interesting,Boring)
--   ]
--   
module Math.Probable.Distribution.Finite -- | Probability type: wrapper around Double for a nicer Show instance and -- for more easily enforcing normalization of weights newtype P P :: Double -> P -- | Get the underlying probability -- --
--   λ> prob (P 0.1)
--   0.1
--   
prob :: P -> Double -- | An event, and its probability data Event a Event :: a -> {-# UNPACK #-} !P -> Event a -- | This event never happens (probability of 0) -- --
--   never = Event undefined 0
--   
never :: Event a -- | EventT monad transformer -- -- It pairs a value with a probability within the m monad newtype EventT m a EventT :: m (Event a) -> EventT m a [runEventT] :: EventT m a -> m (Event a) -- | T distribution of probabilities over a finite set. class (Functor d, Monad d) => Finite d -- | The only requirement is to somehow be able to represent the -- distribution corresponding to the list given as argument, e.g: -- --
--   weighted [(True, 0.8), (False, 0.2)]
--   
-- -- It should also be able to handle the normalization for you. -- --
--   weighted [(True, 8), (False, 2)]
--   
weighted :: Finite d => [(a, Double)] -> d a -- | Fin is just 'EventT []' -- -- You can think of 'Fin a' meaning '[Event a]' i.e a list of the -- possible outcomes of type a with their respective probability type Fin = EventT [] -- | See the outcomes of a finite distribution and their probabilities -- --
--   λ> exact $ uniformly [True, False]
--   [Event True 50.0%,Event False 50.0%]
--   
-- --
--   λ> data Fruit = Apple | Orange deriving (Eq, Show)
--   λ> exact $ uniformly [Apple, Orange]
--   [Event Apple 50.0%,Event Orange 50.0%]
--   
-- --
--   λ> exact $ weighted [(Apple, 0.8), (Orange, 0.2)]
--   [Event Apple 80.0%,Event Orange 20.0%]
--   
exact :: Fin a -> [Event a] -- | Create a Finite distribution over the values in the list, each -- with an equal probability -- --
--   λ> exact $ uniformly [True, False]
--   [Event True 50.0%,Event False 50.0%]
--   
uniformly :: Finite d => [a] -> d a -- | Make finite distributions (Fin) citizens of RandT by -- simply sampling an element at random while still approximately -- preserving the distribution -- --
--   λ> mwc . liftF $ uniformly [True, False]
--   False
--   λ> mwc . liftF $ uniformly [True, False]
--   True
--   λ> mwc . liftF $ weighted [("Haskell", 99), ("PHP", 1)]
--   "Haskell"
--   
liftF :: PrimMonad m => Fin a -> RandT m a -- | FinBayes is Fin with a MaybeT layer -- -- What is that for? The MaybeT lets us express the fact that what -- we've drawn from the distribution isn't of interest anymore, using -- condition, and observing the remaining cases, using -- bayes, to get back to a normal finite distribution. Example: -- --
--   data Wine = Good | Bad deriving (Eq, Show)
--   
--   wines :: Finite d => d Wine
--   wines = weighted [(Good, 0.2), (Bad, 0.8)]
--   
--   twoWines :: Finite d => d (Wine, Wine)
--   twoWines = (,) <*> wines <$> wines
--   
--   decentMeal :: FinBayes (Wine, Wine)
--   decentMeal = do
--     (wine1, wine2) <- twoWines
--     -- we only consider the outcomes of 'twoWines' 
--     -- where at least one of the two wines is good
--     -- because we're having a nice meal and are looking
--     -- for a decent pair of wine
--     condition (wine1 == Good || wine2 == Good)
--     return (wine1, wine2)
--   
--   -- to view the distribution, applying
--   -- Bayes' rule on our way:
--   exact (bayes decentMeal)
--   
type FinBayes = MaybeT Fin -- | This functions discards all the elements of the distribution for which -- the call to condition yielded Nothing. While -- condition does the mapping to Maybe values, this -- function discards all of those values for which the condition was not -- met. bayes :: FinBayes a -> Fin a -- | This is the core of FinBayes. If the Bool is false, the -- current computation is shortcuited (sent to a Nothing in -- MaybeT) and won't be included when running the distribution -- with bayes. See the documentation of FinBayes for an -- example. condition :: Bool -> FinBayes () -- | Keeps only the Justs and remove the Maybe layer in the -- distribution. onlyJust :: Fin (Maybe a) -> Fin a instance GHC.Show.Show a => GHC.Show.Show (Math.Probable.Distribution.Finite.Event a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Math.Probable.Distribution.Finite.Event a) instance GHC.Real.RealFrac Math.Probable.Distribution.Finite.P instance GHC.Real.Real Math.Probable.Distribution.Finite.P instance GHC.Num.Num Math.Probable.Distribution.Finite.P instance GHC.Real.Fractional Math.Probable.Distribution.Finite.P instance GHC.Classes.Ord Math.Probable.Distribution.Finite.P instance GHC.Classes.Eq Math.Probable.Distribution.Finite.P instance Math.Probable.Distribution.Finite.Finite Math.Probable.Distribution.Finite.Fin instance Control.Monad.Primitive.PrimMonad m => Math.Probable.Distribution.Finite.Finite (Math.Probable.Random.RandT m) instance Math.Probable.Distribution.Finite.Finite Math.Probable.Distribution.Finite.FinBayes instance GHC.Base.Monad m => GHC.Base.Functor (Math.Probable.Distribution.Finite.EventT m) instance (GHC.Base.Functor m, GHC.Base.Monad m) => GHC.Base.Applicative (Math.Probable.Distribution.Finite.EventT m) instance GHC.Base.Monad m => GHC.Base.Monad (Math.Probable.Distribution.Finite.EventT m) instance Control.Monad.Trans.Class.MonadTrans Math.Probable.Distribution.Finite.EventT instance GHC.Base.Functor Math.Probable.Distribution.Finite.Event instance GHC.Base.Applicative Math.Probable.Distribution.Finite.Event instance GHC.Base.Monad Math.Probable.Distribution.Finite.Event instance GHC.Show.Show Math.Probable.Distribution.Finite.P module Math.Probable.Distribution -- | Beta distribution (from Statistics.Distribution.Beta) -- --
--   λ> mwc $ listOf 10 (beta 81 219)
--   [ 0.23238372272745833,0.252972980515086,0.22708315774257903
--   , 0.25807200295967214,0.29794072226119983,0.24534701159196015
--   , 0.24766870269839578,0.2994199351220346,0.2728157476212405,0.2593318159573564
--   ]
--   
beta :: PrimMonad m => Double -> Double -> RandT m Double -- | Cauchy distribution (from Statistics.Distribution.Cauchy) -- --
--   λ> mwc $ listOf 10 (cauchy 0 0.1)
--   [ -0.3932758718373347,0.490467375093784,4.2620417667423555e-2
--   , 3.370509874905657e-2,-8.186484692937862e-2,9.371858212168262e-2
--   , -1.1095818809115384e-2,3.0353983716155386e-2,0.22759697862410477
--   , -0.1881828277028582 ]
--   
cauchy :: PrimMonad m => Double -> Double -> RandT m Double -- | Cauchy distribution around 0, with scale 1 (from -- Statistics.Distribution.Cauchy) -- --
--   λ> mwc $ listOf 10 cauchyStd
--   [ 9.409701589649838,-7.361963972107541,0.168746305673769
--   , 5.091825420838711,-0.326080163135388,-1.2989850787629456
--   , -2.685658063444485,0.22671438734899435,-1.602349559644217e-2
--   , -0.6476292643908057 ]
--   
cauchyStd :: PrimMonad m => RandT m Double -- | Chi-squared distribution (from -- Statistics.Distribution.ChiSquared) -- --
--   λ> mwc $ listOf 10 (chiSquare 4)
--   [ 8.068852054279787,1.861584389294606,6.3049415103095265
--   , 1.0512164068833838,1.6243237867165086,5.284901049954076
--   , 0.4773242487947021,1.1753876666374887,5.21554771873363
--   , 3.477574639460651 ]
--   
chiSquared :: PrimMonad m => Int -> RandT m Double -- | Fisher's F-Distribution (from -- Statistics.Distribution.FDistribution) -- --
--   λ> mwc $ listOf 10 (fisher 4 3)
--   [ 3.437898578540642,0.844120450719367,1.9907851466347173
--   , 2.0089975147012784,1.3729208790549117,0.9380430357924707
--   , 2.642389323945247,1.0918121624055352,0.45650856735477335
--   , 2.5134537326659196 ]
--   
fisher :: PrimMonad m => Int -> Int -> RandT m Double -- | Gamma distribution (from Statistics.Distribution.Gamma) -- --
--   λ> mwc $ listOf 10 (gamma 3 0.1)
--   [ 5.683745415884202e-2,0.20726188766138176,0.3150672538487696
--   , 0.4250825346490057,0.5586516230326105,0.46897413151474315
--   , 0.18374916962208182,9.93000480494153e-2,0.6057279704154832
--   , 0.11070190282993911 ]
--   
gamma :: PrimMonad m => Double -> Double -> RandT m Double -- | Gamma distribution, without checking whether the parameter are valid -- (from Statistics.Distribution.Gamma) -- --
--   λ> mwc $ listOf 10 (improperGamma 3 0.1)
--   [ 0.30431838005485,0.4044380297376584,2.8950141419406657e-2
--   , 0.468271612850147,0.18587792578128381,0.22735854572527045
--   , 0.5168050216325927,5.896911236207261e-2,0.24654560998405564
--   , 0.10557650513145429 ]
--   
improperGamma :: PrimMonad m => Double -> Double -> RandT m Double -- | Geometric distribution. -- -- Distribution of the number of trials needed to get one success. See -- Statistics.Distribution.Geometric -- --
--   λ> mwc $ listOf 10 (geometric 0.8)
--   [2,1,1,1,1,1,1,2,1,5]
--   
geometric :: PrimMonad m => Double -> RandT m Int -- | Geometric distribution. -- -- Distribution of the number of failures before getting one success. See -- Statistics.Distribution.Geometric -- --
--   λ> mwc $ listOf 10 (geometric0 0.8)
--   [0,0,0,0,0,1,1,0,0,0]
--   
geometric0 :: PrimMonad m => Double -> RandT m Int -- | Student-T distribution (from -- Statistics.Distribution.StudentT) -- --
--   λ> mwc $ listOf 10 (student 0.2)
--   [ -14.221373473810829,-29.395749168822267,19.448665112984997
--   , -30.00446058929083,-0.5033202547957609,2.321975597874013
--   , 0.7884787761643617,-0.1895113832448149,-131.12901170537924
--   , 1.371956948317759 ]
--   
student :: PrimMonad m => Double -> RandT m Double -- | Uniform distribution between a and b (from -- Statistics.Distribution.Uniform) -- --
--   λ> mwc $ listOf 10 (uniform 0.1 0.2)
--   [ 0.1711914559256124,0.1275212181343327,0.15347702635758945
--   , 0.1743662387063698,0.12047749686635312,0.10719840237585587
--   , 0.10543681342025846,0.13482973080648325,0.19779298960413577
--   , 0.1681037592576508 ]
--   
uniform :: PrimMonad m => Double -> Double -> RandT m Double -- | Normal distribution (from Statistics.Distribution.Normal) -- --
--   λ> mwc $ listOf 10 (normal 4 1)
--   [ 3.6815394812555144,3.5958531529526727,3.775960990625964
--   , 4.413109650155896,4.825826384709198,4.805629590118984
--   , 5.259267547365003,4.45410634165052,4.886537243027636
--   , 3.0409409067356954 ]
--   
normal :: PrimMonad m => Double -> Double -> RandT m Double -- | The standard normal distribution (mean = 0, stddev = 1) (from -- Statistics.Distribution.Normal) -- --
--   λ> mwc $ listOf 10 standard
--   [ 0.2252627935262769,1.1831885443897947,-0.6577353418647461
--   , 2.1574536855051853,-0.16983072710637676,0.9667954287638821
--   , -1.8758605246293683,-0.8578048838241616,1.9516838769731923
--   , 0.43752574431460434 ]
--   
standard :: PrimMonad m => RandT m Double -- | Create a normal distribution using parameters estimated from the -- sample (from Statistics.Distribution.Normal) -- --
--   λ> mwc . listOf 10 $ 
--        normalFromSample $ 
--          V.fromList [1,1,1,3,3,3,4
--                     ,4,4,4,4,4,4,4
--                     ,4,4,4,4,4,5,5
--                     ,5,7,7,7]
--   [ 7.1837511677441395,2.388433817342809,5.252282321156134
--   , 4.988163140851522,0.40102386713467864,4.4840751065620665
--   , 2.1471370686776874,2.6591948802201046,3.843667372514598
--   , 1.7650436484843248 ]
--   
normalFromSample :: PrimMonad m => Sample -> Maybe (RandT m Double) -- | Exponential distribution (from -- Statistics.Distribution.Exponential) -- --
--   λ> mwc $ listOf 10 (exponential 0.2)
--   [ 5.713524665694821,1.7774315204594584,2.434017573227628
--   , 5.463202731505528,0.5403008025455847,14.346316301765576
--   , 7.380393612391503,24.800854500680032,0.8731076703020924
--   , 6.1661076502236645 ]
--   
exponential :: PrimMonad m => Double -> RandT m Double -- | Exponential distribution given a sample (from -- Statistics.Distribution.Exponential) -- --
--   λ> mwc $ listOf 10 (exponentialFromSample $ V.fromList [1,1,1,0])
--   [ 0.4237050903604833,1.934301502525168,0.7435728843566659
--   , 1.8720263209574293,0.605750265970631,0.24103955067365979
--   , 0.6294952762436511,1.660404952631443,0.6448230847113577
--   , 0.8891555734786789 ]
--   
exponentialFromSample :: PrimMonad m => Sample -> Maybe (RandT m Double) -- | Sample from a continuous distribution from the statistics -- package -- --
--   λ> import qualified Statistics.Distribution.Normal as Normal
--   λ> mwc $ continuous (Normal.normalDistr 0 1)
--   -0.7266583064693862
--   
-- -- This is equivalent to using normal from this module. continuous :: (ContGen d, PrimMonad m) => d -> RandT m Double -- | Sample from a discrete distribution from the statistics -- package -- --
--   λ> import qualified Statistics.Distribution.Normal as Normal
--   λ> mwc $ discrete (Geo.geometric 0.6)
--   2
--   
-- -- This is equivalent to using geometric from this module. discrete :: (DiscreteGen d, PrimMonad m) => d -> RandT m Int -- | Easy, composable and efficient random number generation, with support -- for distributions over a finite set and your usual probability -- distributions. module Math.Probable