title: How to access a C array in random order ensuring that all elements are visited at most once
body: <p>Say I have a very big array of 64 bit integers, say a million of them defined like this:</p>
  
  <pre><code>uint64_t myNumbers[1000000];
  </code></pre>
  
  <p>The challenge is how to access each of those elements randomly ensuring that each one is visited once. So for example I could simply use a for loop and iterate through this array and add up all the numbers to get a result (which would overflow, but that's not important).</p>
  
  <p>What I would like to do is repeat that but accessing the elements in that array randomly so that I ultimately end up with the same result as I would have had for the normal iteration.</p>
  
  <p>So how would I go about creating another array of pointers to the original array elements where when iterating through it, it accesses each element randomly. This doesn't have to be done in real time, and the time taken to set up the second array doesn't have to be fast.</p>
  
  <p>Basically I can't think of a good way to generate a random array of pointers to the elements in the first array and could really use some insight from the experts :)</p>