code: public static <ElementT> void shuffleHead(
        @NonNull ElementT[] elements, int n, @NonNull ThreadLocalRandom random) {
      if (n > elements.length) {
        throw new ArrayIndexOutOfBoundsException(
            String.format(
                "Can't shuffle the first %d elements, there are only %d", n, elements.length));
      }
      if (n > 1) {
        for (int i = n - 1; i > 0; i--) {
          int j = random.nextInt(i + 1);
          swap(elements, i, j);
        }
      }
    }
docs: Shuffles the first n elements of the array in-place.
  
  @param elements the array to shuffle.
  @param n the number of elements to shuffle; must be {@code <= elements.length}.
  @param random the {@link ThreadLocalRandom} instance to use. This is mainly intended to
  facilitate tests.
  @see <a
  href="https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm">Modern
  Fisher-Yates shuffle</a>