blob: d590fce3eebd381112331df6f7148b7e4a3c80fd (
plain)
1
2
3
4
5
6
7
8
|
import System.Random
rnd_permu :: [a] -> IO [a]
rnd_permu [] = return []
rnd_permu (x:xs) = do
rand <- randomRIO (0, (length xs))
rest <- rnd_permu xs
return $ let (ys,zs) = splitAt rand rest in ys++(x:zs)
|