public static Cursor cursor(
		final RandomGenerator random,
		final int n,
		final int k
	) {
		requireNonNull(random);
		Subsets.checkSubSet(n, k);

		return new Cursor() {
			@Override
			public boolean next(int[] index) {
				if (index.length != k) {
					throw new IllegalArgumentException(
						"Invalid array size: %d != %d.".formatted(index.length, k)
					);
				}

				Subsets.next(random, n, k);
				return true;
			}

			@Override
			public int size() {
				return k;
			}
		};
	}
Return a new (<em>infinite</em>) cursor which creates k-subsets in a
random order.
{@snippet class="CombinatorialSnippets" region="KSubset.staticRandomCursor"}

@apiNote
The returned cursor may create duplicate k-subsets.

@param random the random generator used for creating random k-subsets
@param n the cardinality of the superset
@param k the cardinality of the subset
@return a new randomized k-subset cursor
@throws NullPointerException if the given {@code random} generator is
        {@code null}
@throws IllegalArgumentException if {@code k <= 0 || n < k} or if
        {@code n*k} overflows
jenetics.incubator/src/main/java/io/jenetics/incubator/combinatorial/KSubset.java