summaryrefslogblamecommitdiff
path: root/21-28/24.hs
blob: 9508438a54251408070bdaa95d1a16f99a4f28eb (plain) (tree)
1
2
3
4
5
6
7
8
9








                                                                                 
import System.Random
diffSelect :: Int -> Int -> IO [Int]

diffSelect n m = d [1..m] n
    where
        d l@(x:xs) n | n > 0 = do i <- getStdRandom $ randomR (0, (length l) - 1)
                                  r <- d (take i l ++ drop (i + 1) l) (n - 1)
                                  return (l!!i:r)
        d _ _ = return []