Safe Haskell | None |
---|---|

Language | Haskell2010 |

## Synopsis

- sample :: (PrimMonad m, Foldable f) => Int -> f a -> Gen (PrimState m) -> m (Maybe [a])
- sampleIO :: Foldable f => Int -> f a -> IO (Maybe [a])
- resample :: (PrimMonad m, Foldable f) => Int -> f a -> Gen (PrimState m) -> m [a]
- resampleIO :: Foldable f => Int -> f a -> IO [a]
- psample :: (PrimMonad m, Foldable f) => Int -> f (Double, a) -> Gen (PrimState m) -> m (Maybe [a])
- psampleIO :: Foldable f => Int -> f (Double, a) -> IO (Maybe [a])
- presample :: (PrimMonad m, Foldable f) => Int -> f (Double, a) -> Gen (PrimState m) -> m [a]
- presampleIO :: Foldable f => Int -> f (Double, a) -> IO [a]
- module System.Random.MWC

# Without replacement

sample :: (PrimMonad m, Foldable f) => Int -> f a -> Gen (PrimState m) -> m (Maybe [a]) Source #

(*O(n)*) Sample uniformly, without replacement.

Returns Nothing if the desired sample size is larger than the collection being sampled from.

# With replacement

resample :: (PrimMonad m, Foldable f) => Int -> f a -> Gen (PrimState m) -> m [a] Source #

(*O(n log n)*) Sample uniformly with replacement (bootstrap).

# Unequal probability, without replacement

psample :: (PrimMonad m, Foldable f) => Int -> f (Double, a) -> Gen (PrimState m) -> m (Maybe [a]) Source #

(*O(n log n)*) Unequal probability sampling.

Returns Nothing if the desired sample size is larger than the collection being sampled from.

psampleIO :: Foldable f => Int -> f (Double, a) -> IO (Maybe [a]) Source #

(*O(n log n)*) `psample`

specialized to IO.

# Unequal probability, with replacement

presample :: (PrimMonad m, Foldable f) => Int -> f (Double, a) -> Gen (PrimState m) -> m [a] Source #

(*O(n log n)*) Unequal probability resampling.

presampleIO :: Foldable f => Int -> f (Double, a) -> IO [a] Source #

(*O(n log n)*) `presample`

specialized to IO.

# Re-exported

module System.Random.MWC