title: Permutations of binary number by swapping two bits (not lexicographically)
body: <p>I'm looking for an algorithm which computes all permutations of a bitstring of given length (<code>n</code>) and amount of bits set (<code>k</code>). For example while <code>n=4</code> and <code>k=2</code> the algorithm shall output:<br>  </p>
  
  <pre><code>1100
  1010
  1001
  0011
  0101
  0110
  </code></pre>
  
  <p>I'm aware of Gosper's Hack which generates the needed permutations in lexicographic order. But i need them to be generated in such a manner, that two consecutive permutations differ in only two (or at least a constant number of) bitpositions (like in the above example).
  Another bithack to do that would be awesome, but also a algorithmic description would help me alot.</p>