random-shuffle-0.0.4: Random shuffle implementation.

Copyright | (c) 2009 Oleg Kiselyov Manlio Perillo
License | BSD3 (see LICENSE file)
Safe Haskell | Safe-Inferred
Language | Haskell98

System.Random.Shuffle

Description

Synopsis

- shuffle :: [a] -> [Int] -> [a]
- shuffle' :: RandomGen gen => [a] -> Int -> gen -> [a]
- shuffleM :: MonadRandom m => [a] -> m [a]

# Documentation

shuffle :: [a] -> [Int] -> [a] Source #

Given a sequence (e1,...en) to shuffle, and a sequence (r1,...r[n-1]) of numbers such that r[i] is an independent sample from a uniform random distribution [0..n-i], compute the corresponding permutation of the input sequence.

shuffle' :: RandomGen gen => [a] -> Int -> gen -> [a] Source #

Given a sequence (e1,...en) to shuffle, its length, and a random generator, compute the corresponding permutation of the input sequence.

shuffleM :: MonadRandom m => [a] -> m [a] Source #

shuffle' wrapped in a random monad