perfect-vector-shuffle: Library for performing vector shuffles

[ bsd3, library, program, random, vector ] [ Propose Tags ]

This package contains functions for performing in-place Fisher--Yates shuffles on mutable and immutable vectors along with some related functionality. The shuffles are uniform at random amongst all permuations.

For an example of how to use it:

module Main where

import Data.Vector
import Immutable.Shuffle

main :: IO ()
main = do {
shuffleMyVector >>= print;
cycleMyVector   >>= print;
derangeMyVector >>= print;

myVector :: Vector Int
myVector = fromList [1..10]

shuffleMyVector :: IO (Vector Int)
shuffleMyVector = shuffleM myVector

cycleMyVector :: IO (Vector Int)
cycleMyVector = maximalCycleM myVector

derangeMyVector :: IO (Vector Int)
derangeMyVector = derangementM myVector

This gives the following:

>>> main

>>> main
Versions [RSS] [faq] 0.1.0, 0.1.1,
Change log
Dependencies base (>=4.9 && <4.15), MonadRandom (>= && <0.6), perfect-vector-shuffle, primitive (>=0.6.4 && <0.8), random (>=1.1 && <1.3), vector (>=0.12.0 && <0.13) [details]
License BSD-3-Clause
Copyright 2019
Author Callan McGill
Revised Revision 5 made by callanmcgill at 2021-02-15T23:30:21Z
Category Random, Vector
Home page
Bug tracker
Source repo head: git clone
Uploaded by callanmcgill at 2019-10-21T14:39:10Z
Distributions LTSHaskell:, NixOS:
Executables example
Downloads 1310 total (9 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs uploaded by user
Build status unknown [no reports yet]


[Index] [Quick Jump]


Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees