Of course, if you do the maths, you will find the number of possible permutations - an impractical situation to deal with. A rather easier and more manageable way could be to get a sample of 50 permutations is to generate the 50 random permutations directly, without ever needing to list or store all the possible ones. You can easily generate a random vector of length 50 consisting of numbers from 1 to 50. And pick up the elements from the indexed locations and save it in a new vector.