title: How to decrease counter in for loop?
body: <p>I'm using the array shuffle function from here: <a href="http://iosdevelopertips.com/swift-code/swift-shuffle-array-type.html" rel="nofollow">http://iosdevelopertips.com/swift-code/swift-shuffle-array-type.html</a>.</p>
  
  <p>On this line:</p>
  
  <pre><code>for var index = array.count - 1; index &gt; 0; index -= 1   
  </code></pre>
  
  <p>in the code below</p>
  
  <pre><code>func shuffleArray&lt;T&gt;( arrayparam: Array&lt;T&gt;) -&gt; Array&lt;T&gt;
  {
      var array = arrayparam
      for var index = array.count - 1; index &gt; 0; index -= 1
      {
          // Random int from 0 to index-1
          let j = Int(arc4random_uniform(UInt32(index-1)))
  
          // Swap two array elements
          // Notice '&amp;' required as swap uses 'inout' parameters
          swap(&amp;array[index], &amp;array[j])
      }
      return array
  }
  </code></pre>
  
  <p>Swift throws this warning:</p>
  
  <blockquote>
    <p>C-style for statement is deprecated and will be removed in a future
    version of Swift</p>
  </blockquote>
  
  <p>There isn't any recommendation of what should be used here.  Any ideas what should replace it?</p>