9 lines
247 B
Text
9 lines
247 B
Text
def shuffle(array, random) {
|
|
for bound in (2..(array.size())).descending() {
|
|
def i := random.nextInt(bound)
|
|
def swapTo := bound - 1
|
|
def t := array[swapTo]
|
|
array[swapTo] := array[i]
|
|
array[i] := t
|
|
}
|
|
}
|