I'm looking for library function which returns any combination of n subset from the k set. For example I have a set {1,2,3,4,5} and I need any combination of 3 numbers included in this set. Order doesn't matter. So this function should returns:
[[1, 2, 3], [1, 2, 4], [1, 2, 5], [1, 3, 4], [1, 3, 5], [1, 4, 5], [2, 3, 4], [2, 3, 5], [2, 4, 5], [3, 4, 5]]
I have tried to write it by myself, but unsuccesfully and I give up. It works only when I take 3 numbers from any set. Maybe someone knows library function for this issue.