I am trying to generate an NxM matrix consisting of integers between 1 and P. Assume M < P. For each row, I would like the M integers to be distinct. This can easily be accomplished by generating each row with the command randperm(P, M). However, in addition to that, I would like for each of the N rows to be a different set of integers (ideally all rows would be distinct under permutations - i.e, if [1,2,3] was a row, I would like to disallow repetitions of [1,2,3] in addition to arbitrary permutations of those integers. This may be too tricky though, in which case I'm fine just excluding [1,2,3]). Is there any simple way of accomplishing this?
For example, let P = 4, and consider trying to generate a 3x2 matrix. The following would be allowed: