title: Calculate possible permutations of an array of numbers
body: <p>I have an NSArray with the numbers {0,1,2,3}</p>
  
  <p>Calculating the factorial of 4 (the count of the array), I have 24 possible permutations of 0,1,2,3</p>
  
  <p>I would like to know if there is a way to calculate all of these possible permutations and place them in a separate array.</p>
  
  <p>For example, given the numbers above, {0,1,2,3}, the resulting permutations would be:</p>
  
  <pre><code>0123, 0132, 0213, 0231, 0312, 0321,
  1023, 1032, 1203, 1230, 1302, 1320,
  2013, 2031, 2103, 2130, 2301, 2310,
  3012, 3021, 3102, 3120, 3201, 3210
  </code></pre>
  
  <p>Any help is greatly appreciated. Thank you so much!</p>