@Override
	public Iterator<int[]> iterator() {
		return new Iterator<>() {
			private final Cursor cursor = cursor();
			private final int[] value = new int[k];

			private boolean hasNext = false;
			private boolean finished = false;

			@Override
			public boolean hasNext() {
				if (finished) return false;
				if (hasNext) return true;

				try {
					return (hasNext = cursor.next(value));
				} finally {
					if (!hasNext) finished = true;
				}
			}

			@Override
			public int[] next() {
				if (!hasNext()) {
					throw new NoSuchElementException();
				}

				hasNext = false;
				return value.clone();
			}
		};
	}
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