public static List<Long> generateRandomIntegerSubset(long n, long k) {
		if (n < 0) {
			throw new IllegalArgumentException("n cannot be negative");
		}
		if (k < 0) {
			throw new IllegalArgumentException("k cannot be negative");
		}
		if (n < k) {
			throw new IllegalArgumentException(
				"size of subset (" + k + ") cannot be larger than size of set (" + n + ")");
		}
		Map<Long, Long> permutation = new HashMap<>();
		for (long i = 0; i < k; ++i) {
			swap(permutation, i, ThreadLocalRandom.current().nextLong(i, n));
		}
		List<Long> random = new ArrayList<>();
		for (long i = 0; i < k; i++) {
			random.add(permutation.getOrDefault(i, i));
		}
		return random;
	}
Generates of random subset of size {@code k} of the set [0,1,...n-1] by generating
a random permutation 
@param n size of set (must be >= 0)
@param k size of random subset (must be >= 0)
@return list of indices of elements in random subset
Ghidra/Extensions/MachineLearning/src/main/java/ghidra/machinelearning/functionfinding/RandomSubsetUtils.java