private static void invert(
		final int n,
		final int[] a
	) {
		final int k = a.length;

		int v = n - 1;
		int j = n - k - 1;
		int vi;

		final int[] ac = Arrays.copyOfRange(a, 0, n - k);
		for (int i = k; --i >= 0;) {
			while ((vi = indexOf(ac, j, v)) != -1) {
				--v;
				j = vi;
			}

			a[i] = v--;
		}
	}
Selects a random subset of size {@code k} from a set of size {@code n}.

@param n the size of the set.
@param k the size of the subset.
@param rnd the random number generator used.
@throws NullPointerException if {@code random} is {@code null}.
@throws IllegalArgumentException if {@code n < k}, {@code k == 0} or if
        {@code n*k} will cause an integer overflow.
@return the a-set array for the given parameter. The returned subset
        array is sorted in increasing order.
jenetics/src/main/java/io/jenetics/internal/math/Subsets.java