public static void next(
		final RandomGenerator rnd,
		final int n,
		final int[] a
	) {
		requireNonNull(rnd, "Random");
		requireNonNull(a, "Sub set array");

		final int k = a.length;
		checkSubSet(n, k);

		// Early return if k == n.
		if (k == n) {
			for (int i = 0; i < k; ++i) {
				a[i] = i;
			}
			return;
		}

		// Calculate the 'inverse' subset if k > n - k.
		if (k > n - k) {
			subset0(rnd, n, n - k, a);
			invert(n, a);
		} else {
			subset0(rnd, n, k, a);
		}
	}
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