title: Algorithm to generate all unique permutations of fixed-length integer partitions?
body: <p>I'm searching for an algorithm that generates all permutations of fixed-length partitions of an integer. Order does not matter.</p>
  
  <p>For example, for n=4 and length L=3:</p>
  
  <pre><code>[(0, 2, 2), (2, 0, 2), (2, 2, 0),
   (2, 1, 1), (1, 2, 1), (1, 1, 2),
   (0, 1, 3), (0, 3, 1), (3, 0, 1), (3, 1, 0), (1, 3, 0), (1, 0, 3),
   (0, 0, 4), (4, 0, 0), (0, 4, 0)]
  </code></pre>
  
  <p>I bumbled about with integer partitions + permutations for partitions whose length is lesser than L; but that was too slow because I got the same partition multiple times (because <code>[0, 0, 1]</code> may be a permutation of <code>[0, 0, 1]</code> ;-)</p>
  
  <p>Any help appreciated, and no, this isn't homework -- personal interest :-)</p>