perfect-vector-shuffle: Library for performing vector shuffles

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

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 0.1.0, 0.1.1,,,
Change log
Dependencies base (>=4.9 && <4.14), MonadRandom (>= && <0.6), perfect-vector-shuffle (>= && <0.2), primitive (>=0.7 && <0.8), random (>=1.1 && <1.2), vector (>=0.12.0 && <0.13) [details]
License BSD-3-Clause
Copyright 2019
Author Callan McGill
Category Random, Vector
Home page
Bug tracker
Source repo head: git clone
Uploaded by callanmcgill at 2019-10-21T14:28:21Z


[Index] [Quick Jump]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees