Here you can find the source of permuteList(List
private static List<String> permuteList(List<String> inList)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; import java.util.Random; public class Main { private static List<String> permuteList(List<String> inList) { //permute list List<String> result = new ArrayList<String>(); Random rand = new Random(System.currentTimeMillis()); int count = 0; int currIndex = inList.size() - 1; for (; count < inList.size(); count++) { int randPosition = rand.nextInt(currIndex + 1); String currLine = inList.get(randPosition); result.add(currLine);/*w ww . jav a 2 s.co m*/ inList.set(randPosition, inList.get(currIndex)); inList.set(currIndex, currLine); currIndex--; } return result; } }