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

Safe HaskellNone
LanguageHaskell2010

Immutable.Shuffle

Description

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

Synopsis

Documentation

shuffle :: forall a g. RandomGen g => Vector a -> g -> (Vector a, g) Source #

Perform a shuffle on an immutable vector with a given random generator returning a shuffled vector and a new generator.

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

Perform a shuffle on an input immutable vector in a monad which has a source of randomness.