What I'm asking is how can I initiallize a list of all the different variations of an array of a specified size holding a specified number of the same element?
So for example an array of size 5 holding three of the same element could be done in these ways, where X's are the elements and O's are the empty spaces.
1) [X, X, X, O, O]
2) [X, X, O, X, O]
3) [X, X, O, O, X]
4) [X, O, X, X, O]
5) [X, O, X, O, X]
6) [X, O, O, X, X]
7) [O, X, X, X, O]
8) [O, X, X, O, X]
9) [O, X, O, X, X]
10) [O, O, X, X, X]
What algorithm could be used to create this kind of result?