RosettaCodeData/Task/Knuth-shuffle/FunL/knuth-shuffle.funl

10 lines
142 B
Text
Raw Permalink Normal View History

2016-12-05 23:44:36 +01:00
def shuffle( a ) =
res = array( a )
n = a.length()
for i <- 0:n
r = rnd( i:n )
res(i), res(r) = res(r), res(i)
res.toList()