diff options
Diffstat (limited to '21-28/23.hs')
-rw-r--r-- | 21-28/23.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/21-28/23.hs b/21-28/23.hs new file mode 100644 index 0000000..e042f97 --- /dev/null +++ b/21-28/23.hs @@ -0,0 +1,8 @@ +import System.Random +rndSelect :: [a] -> Int -> IO [a] + +rndSelect l n + | n > 0 = do r <- rndSelect l (n - 1) + i <- getStdRandom $ randomR (0, (length l) - 1) + return (l!!i:r) + | otherwise = return [] |