[Haskell-cafe] Acquiring a random set of a specific size (w/o dups) from a range of Ints

Arlen Christian Mart Cuss celtic at sairyx.org
Tue Jun 14 02:29:25 CEST 2011


On Mon, 2011-06-13 at 16:56 -0700, michael rice wrote:
> Is there an (existing) way to select 5 Ints randomly (no duplicates)
> from a population, say 1-20 (inclusive)?
> 


Does anything from random-extras look like it'll work?
http://hackage.haskell.org/packages/archive/random-extras/0.17/doc/html/Data-Random-Extras.html

Shuffle [1..20], then take 5?




More information about the Haskell-Cafe mailing list