jdk/src/share/classes/java/util/Collections.java
changeset 5781 11a42d91eb56
parent 5506 202f599c92aa
child 7518 0282db800fe1
equal deleted inserted replaced
5780:3f7be5f312ae 5781:11a42d91eb56
   461      * @param  list the list to be shuffled.
   461      * @param  list the list to be shuffled.
   462      * @throws UnsupportedOperationException if the specified list or
   462      * @throws UnsupportedOperationException if the specified list or
   463      *         its list-iterator does not support the <tt>set</tt> operation.
   463      *         its list-iterator does not support the <tt>set</tt> operation.
   464      */
   464      */
   465     public static void shuffle(List<?> list) {
   465     public static void shuffle(List<?> list) {
   466         if (r == null) {
   466         Random rnd = r;
   467             r = new Random();
   467         if (rnd == null)
   468         }
   468             r = rnd = new Random();
   469         shuffle(list, r);
   469         shuffle(list, rnd);
   470     }
   470     }
   471     private static Random r;
   471     private static Random r;
   472 
   472 
   473     /**
   473     /**
   474      * Randomly permute the specified list using the specified source of
   474      * Randomly permute the specified list using the specified source of