-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Sample values from collections. -- -- Basic sampling tools. -- -- Exports variations on two simple functions for sampling from arbitrary -- Foldable collections: -- -- -- -- Each variation can be prefixed with p to sample from a -- container of values weighted by probability. @package sampling @version 0.3.0 module Numeric.Sampling -- | (O(n)) Sample uniformly, without replacement. -- -- Returns Nothing if the desired sample size is larger than the -- collection being sampled from. sample :: (PrimMonad m, Foldable f) => Int -> f a -> Gen (PrimState m) -> m (Maybe [a]) -- | (O(n)) sample specialized to IO. sampleIO :: Foldable f => Int -> f a -> IO (Maybe [a]) -- | (O(n log n)) Sample uniformly with replacement (bootstrap). resample :: (PrimMonad m, Foldable f) => Int -> f a -> Gen (PrimState m) -> m [a] -- | (O(n log n)) resample specialized to IO. resampleIO :: Foldable f => Int -> f a -> IO [a] -- | (O(n log n)) Unequal probability sampling. -- -- Returns Nothing if the desired sample size is larger than the -- collection being sampled from. psample :: (PrimMonad m, Foldable f) => Int -> f (Double, a) -> Gen (PrimState m) -> m (Maybe [a]) -- | (O(n log n)) psample specialized to IO. psampleIO :: Foldable f => Int -> f (Double, a) -> IO (Maybe [a]) -- | (O(n log n)) Unequal probability resampling. presample :: (PrimMonad m, Foldable f) => Int -> f (Double, a) -> Gen (PrimState m) -> m [a] -- | (O(n log n)) presample specialized to IO. presampleIO :: (Foldable f) => Int -> f (Double, a) -> IO [a]