title: Why does Collections.shuffle() fail for my array?
body: <p>Why does my code not work?</p>
  
  <pre><code>package generatingInitialPopulation;
  
  import java.util.Arrays;
  import java.util.Collections;
  
  public class TestShuffle {
      public static void main(String[] args) {
          int[] arr = new int[10];
  
          for (int i = 0; i &lt; arr.length; i++) {
              arr[i] = i;
          }
  
          Collections.shuffle(Arrays.asList(arr));
  
          for (int i = 0; i &lt; arr.length; i++) {
              System.out.print(arr[i] + " ");
          }
      }
  }
  </code></pre>
  
  <p>The result is: 0 1 2 3 4 5 6 7 8 9.</p>
  
  <p>I was expecting a <strong>randomly shuffled sequence</strong>.</p>