cabal-version: 2.2 category: Random, Vector build-type: Simple name: perfect-vector-shuffle synopsis: Library for performing vector shuffles version: 0.1.1 author: Callan McGill maintainer: callan.mcgill@gmail.com homepage: https://github.com/Boarders/perfect-vector-shuffle bug-reports: https://github.com/Boarders/perfect-vector-shuffle/issues copyright: 2019 license: BSD-3-Clause description: . 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 [2,8,1,5,10,9,7,3,6,4] [6,8,4,10,9,2,5,7,3,1] [8,5,4,1,10,9,3,6,2,7] . >>> main [7,9,3,5,10,6,8,1,2,4] [2,4,10,7,8,1,5,9,3,6] [4,8,5,2,7,3,9,6,10,1] @ extra-source-files: CHANGELOG.md source-repository head type: git location: https://github.com/Boarders/perfect-vector-shuffle Library hs-source-dirs: src ghc-options: -Wall -fexpose-all-unfoldings -fspecialize-aggressively build-depends: base ^>= 4.12.0.0 , MonadRandom >= 0.5.1.1 && < 0.6 , primitive >= 0.6.4.0 && < 0.7 , random ^>= 1.1 , vector >= 0.12.0 && < 0.13 exposed-modules: Immutable.Shuffle Mutable.Shuffle other-modules: default-language: Haskell2010 Test-Suite testsuite type: exitcode-stdio-1.0 main-is: Test.hs hs-source-dirs: test ghc-options: -Wall -fexpose-all-unfoldings -fspecialize-aggressively -Wincomplete-patterns build-depends: perfect-vector-shuffle ^>= 0.1.1 , base ^>= 4.12.0.0 , QuickCheck ^>= 2.12.6.1 , random ^>= 1.1 , tasty >= 1.2 && < 1.3 , tasty-quickcheck ^>= 0.10 , vector >= 0.12.0 && < 0.13 , quickcheck-instances >= 0.3.19 && < 0.4 other-modules: Immutable.Test default-language: Haskell2010 --Executable example -- -- main-is: Example.hs -- -- hs-source-dirs: src -- -- ghc-options: -Wall -- -fexpose-all-unfoldings -- -fspecialize-aggressively -- -Wincomplete-patterns -- -- build-depends: perfect-vector-shuffle ^>= 0.1.1 -- , base ^>= 4.12.0 -- , MonadRandom >= 0.5.1.1 && < 0.6 -- , primitive >= 0.6.4.0 && < 0.7 -- , random ^>= 1.1 -- , vector >= 0.12.0 && < 0.13 -- -- default-language: Haskell2010