title: Shuffling the results from an NSFetchedResultsController
body: <p>I'm using an <code>NSFetchedResultsController</code> to pull a few thousand results out of a Core Data structure and display them in a <code>UITableView</code>. I have a few available options that perform fetches with predicates and display that updated data, such as search by keyword, sort by author, etc.</p>
  
  <p>I'd like to randomly shuffle the order before they're displayed. I've created a category of <code>NSArray</code> with a <code>shuffle</code> method which works perfectly, but calling that method on <code>[self.fetchedResultsController fetchedObjects]</code> has no effect, the data remains unchanged. I'm assuming that this is because <code>fetchedObjects</code> is <code>readonly</code>, and that I'd need to make a copy.</p>
  
  <p>I've made that copy, but the snag I've hit is in making that new array co-exist peacefully with the <code>fetchedObjects</code> array. I can go off to various detail views and modify the content, so I'm trying to ascertain how I can keep <code>fetchedObjects</code> and my <code>shuffledFetchedObjects</code> array in sync, even though their content is in a different order.</p>
  
  <p>Here's my simple little <code>shuffle</code> category:</p>
  
  <pre><code>- (NSArray *) shuffle {
      NSMutableArray *tmp = [NSMutableArray arrayWithArray: self];
      for (int i = [tmp count] - 1; i &gt; 0; i--) [tmp exchangeObjectAtIndex: arc4random() % (i + 1) withObjectAtIndex: i];
      return [NSArray arrayWithArray: tmp];
  }
  </code></pre>
  
  <p>What options do I have for achieving this?</p>