title: Iterate over a random permutation of numbers in the range 0..n with large n
body: <p>I need to iterate over a random permutation of integers in the range <code>0..n</code>.</p>
  <p>My first idea was to create an array of sequential integers and shuffle it. It works well for small <code>n</code> but gets slow and uses too much memory with larger <code>n</code>s (<code>n</code> &gt; 1000000). (see: <a href="https://jsfiddle.net/cveqm4nj/" rel="nofollow noreferrer">https://jsfiddle.net/cveqm4nj/</a> which takes &gt;100ms to run on my machine)</p>
  <p>How can I create an iterator which returns non-repeating integers in the range <code>0..n</code> without allocating an array of size n?</p>