Given a list, possibly with repeated elements, I am trying to get a list that consists of a specified number of distinct permutations of the list. Essentially, I want to something that works like Take[Permutations[mylist],100]
which gives the first 100 permutations of mylist
. The issue is that this code first computes Permutations[mylist]
and then takes the first 100 elements, which is a waste of time and memory space, and will throw errors if mylist is too large.
Essentially, I want something that gives the same output as Take[Permutations[mylist],100]
but runs more efficiently.
This seems like a very basic problem but I can't figure out how to implement it. Any assistance is appreciated!