Here you can find the source of Shuffle(ArrayList
Parameter | Description |
---|---|
list | List of String objects |
randomNumberGenerator | Random number generator that will be used for shuffling |
public static ArrayList<String> Shuffle(ArrayList<String> list, Random randomNumberGenerator)
//package com.java2s; // it under the terms of the GNU General Public License as published by import java.util.*; public class Main { /** This method randomly shuffles a list of String objects. */*w w w . j a v a 2 s. c om*/ * @param list List of String objects * @param randomNumberGenerator Random number generator that will be used for shuffling * @return Shuffled list */ public static ArrayList<String> Shuffle(ArrayList<String> list, Random randomNumberGenerator) { ArrayList<String> shuffled = new ArrayList<String>(list); Collections.shuffle(shuffled, randomNumberGenerator); return shuffled; } }