swap

fun <V> swap(ary: Array<V>, i: Int, j: Int)(source)

Swaps the elements at two specified indices in the given array.

Parameters

ary

the array in which the elements are to be swapped

i

the index of the first element to be swapped

j

the index of the second element to be swapped