blob: e042f9727adf840e5006bd1927767766b4dede3a (
plain) (
tree)
|
|
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 []
|