summaryrefslogtreecommitdiff
path: root/21-28/23.hs
blob: e042f9727adf840e5006bd1927767766b4dede3a (plain) (blame)
1
2
3
4
5
6
7
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 []