perfect-vector-shuffle-0.1.0: Library for performing vector shuffles

Safe HaskellNone
LanguageHaskell2010

Mutable.Shuffle

Description

This module provides functions to perform shuffles on mutable vectors. The shuffling is uniform amongst all permuations and uses the minimal number of transpositions.

Synopsis

Documentation

shuffle :: forall m a g. (PrimMonad m, RandomGen g) => MVector (PrimState m) a -> g -> m g Source #

Perform a shuffle on a mutable vector with a given random generator, returning a new random generator.

shuffleM :: forall m a. (PrimMonad m, MonadRandom m) => MVector (PrimState m) a -> m () Source #

Perform a shuffle on a mutable vector in a monad which has a source of randomness.