title: Generate a random derangement of a list
body: <p>How can I randomly shuffle a list so that none of the elements remains in its original position?</p>
  
  <p>In other words, given a list <code>A</code> with distinct elements, I'd like to generate a permutation <code>B</code> of it so that</p>
  
  <ul>
  <li>this permutation is random</li>
  <li>and for each <code>n</code>, <code>a[n] != b[n]</code></li>
  </ul>
  
  <p>e.g.</p>
  
  <pre><code>a = [1,2,3,4]
  b = [4,1,2,3] # good
  b = [4,2,1,3] # good
  
  a = [1,2,3,4]
  x = [2,4,3,1] # bad
  </code></pre>
  
  <p><s>I don't know the proper term for such a permutation (is it "total"?) thus having a hard time googling.</s> The correct term appears to be "derangement".</p>