Java Array Shuffle shuffleList(List list)

Here you can find the source of shuffleList(List list)

Description

Shuffles a list.

License

Open Source License

Parameter

Parameter Description
list the list to shuffle

Declaration

public static void shuffleList(List<?> list) 

Method Source Code


//package com.java2s;
import java.util.Collections;
import java.util.List;
import java.util.Random;

public class Main {
    /**/*from  w  ww.ja  va 2 s.  co m*/
     * Shuffles a list.
     * @param list the list to shuffle
     */
    public static void shuffleList(List<?> list) {
        long seed = System.nanoTime();
        Collections.shuffle(list, new Random(seed));
    }
}

Related

  1. shuffledList(List list)
  2. shuffleInPlace(E[] elems, Random rand)
  3. shuffleInPlace(int[] toShuffle, Random random)
  4. shuffleIntArray(int[] arr)
  5. shuffleIntArray(int[] array)
  6. shuffleList(List list)
  7. shuffleSublist(List objects, int start, int end)