title: Create an NSRange with a given minimal and maximal value
body: <p>I have a collection of int64_t values that I need to make an index set out of. I previously have used: </p>
  
  <pre><code>NSIndexSet *set = [NSIndexSet indexSetWithRange:NSMakeRange(location, length)];
  </code></pre>
  
  <p>to make index sets, but this time its unclear to me how I would do this based on the information I have.</p>
  
  <p>Specifics: I have a collection of values. I know the highest value in the collection, the lowest value in the collection and the number of values in the collection. However, the values are not necessarily consecutive.  </p>
  
  <p>For example, if I have the following values: 1,3,4,6,7,9 I would like to create a set that includes all numbers in the collection between and including 1 and 9, i.e. set = 1-9.</p>
  
  <p>How would I do this?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>I shouldn't say I have a "collection" of integers, rather - I have objects stored in core data and each object has an int64_t attribute associated with it, so I don't have a pointer to an actual collection of the objects, and I want to avoid fetching the objects just to create a collection.</p>