diff options
author | Determinant <ted.sybil@gmail.com> | 2017-05-29 01:11:20 -0400 |
---|---|---|
committer | Determinant <ted.sybil@gmail.com> | 2017-05-29 01:11:20 -0400 |
commit | fa1bf6c2eac1c9f7969ff29504c9f51b9ba48008 (patch) | |
tree | 3ff5689d025100431adac277d0411ca88681166e /21-28/24.hs | |
parent | 9c608c32a9387a1dd1cb045e5822733ad181ccf8 (diff) |
finish vol 3
Diffstat (limited to '21-28/24.hs')
-rw-r--r-- | 21-28/24.hs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/21-28/24.hs b/21-28/24.hs new file mode 100644 index 0000000..9508438 --- /dev/null +++ b/21-28/24.hs @@ -0,0 +1,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 [] |