title: to generate random permutation of a array in O(n) time and O(1) space
body: <p>We have to generate Array <code>{1,2,3,..,n}</code> in <code>O(1)</code> space.<br>
  I am able to do it in <code>O(n)</code> space. </p>
  
  <p>I did <code>O(n)</code> space solution by first storing the array and then randomizing it in place. But how to do it without storing array in <code>O(1)</code> space. </p>
  
  <p>I m just generating random number and instead of storing them I need to print them as storing would require O(n) space but I need to do it in O(1) space and what my doubt is if we go on generating random number and print them there may be some numbers between 1 to n which may be generated more than once and some may not be generated. So How do I manage to print all numbers exactly once in O(1) space?</p>
  
  <p>P.S.- I am not given any array. Input is just 'n' and I have to print the permutation of array {1,2,3,...,n} in O(n) time and in O(1) space.</p>