title: What is the probability that the array will remain the same?
body: <p>This question has been asked in Microsoft interview. Very much curious to know why these people ask so strange questions on probability?</p>
  
  <p>Given a rand(N), a random generator which generates random number from 0 to N-1.</p>
  
  <pre><code>int A[N]; // An array of size N
  for(i = 0; i &lt; N; i++)
  {
      int m = rand(N);
      int n = rand(N);
      swap(A[m],A[n]);
  }
  </code></pre>
  
  <p><strong>EDIT:</strong> Note that the seed is not fixed.</p>
  
  <p>what is the probability that array A remains the same?<br>
  Assume that the array contains unique elements.</p>