I have the number 1,2,...,N and from them I want to take k distinct combinations of size p without repetition.
For example, if N = 10, k = 4 and p = 3, a possible desired outcome would be:
But not:
since [1 4 9] and [1 9 4] are the same combination. Nor do I want output like [1 1 4], since the number 1 occurs twice, and I want without repetition.
I've looked into a lot of Matlab functions (some of them on the file exchange), like COMBINATOR, PERMS, RANDPERM, NCHOOSEK, KTHCOMBN, but none do exactly what I'm asking, and I don't know how to alter/use them into doing so.
What I initially thought of was storing all possible combinations and them (randomly) picking k of them. However, that easily runs into memory issues...
Cheers