function swap(array, index1, index2) {
    const value = array[index1];
    array[index1] = array[index2];
    array[index2] = value;
}
Swaps the positions of two values in an array.
@param {Array} array The array to swap values in.
@param {int} index1 The first index to swap. 
@param {int} index2 The second index to swap.
@returns {void}
@private