News for hackers. Stuff that matters.
Re:Show HN: A visual explanation of Fisher–Yates shuffle by longlivedeath on Thursday January 19, 2012 @04:49AM (#3483817)
Thank you, now I see. Here's my version:

    shuffle :: (ChoiceMonad m, Eq a) => [a] -> m [a]
    shuffle [] = return []
    shuffle elems = do 
      x <- choice elems
      xs <- shuffle (x `delete` elems)
      return (x:xs)

There are no comments on this comment yet.