function shuffle(arr, opt_randFn) {
  const randFn = opt_randFn || Math.random;

  for (let i = arr.length - 1; i > 0; i--) {
    // Choose a random array index in [0, i] (inclusive with i).
    const j = Math.floor(randFn() * (i + 1));

    const tmp = arr[i];
    arr[i] = arr[j];
    arr[j] = tmp;
  }
}
Shuffles the values in the specified array using the Fisher-Yates in-place
shuffle (also known as the Knuth Shuffle). By default, calls Math.random()
and so resets the state of that random number generator. Similarly, may reset
the state of any other specified random number generator.

Runtime: O(n)

@param {!Array<?>} arr The array to be shuffled.
@param {function():number=} opt_randFn Optional random function to use for
    shuffling.
    Takes no arguments, and returns a random number on the interval [0, 1).
    Defaults to Math.random() using JavaScript's built-in Math library.