equal
deleted
inserted
replaced
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 |