99 questions/Solutions/25

From HaskellWiki
< 99 questions‎ | Solutions
Revision as of 15:59, 13 July 2010 by Wapcaplet (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Generate a random permutation of the elements of a list.

rnd_permu xs = diff_select' (length xs) xs

Uses the solution for the previous problem. Choosing N distinct elements from a list of length N will yield a permutation.