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

10 lines
142 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04: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()