
16 Feb
2009
16 Feb
'09
8:41 a.m.
Alberto Ruiz wrote:
How about using random doubles?
randomPerm xs = fmap (map snd . sort . flip zip xs) rs where rs = fmap (randoms . mkStdGen) randomIO :: IO [Double]
Interesting idea. The chance of duplicates should be negligible now, but that's because we're using a large amount of random bits, far more than n! would require. Regards, apfelmus -- http://apfelmus.nfshost.com