Android examples for java.util:List
scramble List
//package com.java2s; import java.security.SecureRandom; import java.util.ArrayList; import java.util.List; public class Main { private static SecureRandom random = new SecureRandom(); public static <T extends Object> void scramble(List<T> list) { List<T> tmpList = new ArrayList<T>(); for (int i = 0; i < 2; i++) { tmpList.clear();//from w w w.ja va 2s . com tmpList.addAll(list); list.clear(); while (tmpList.size() > 0) { list.add(tmpList.remove((int) (tmpList.size() * random()))); } } } public static double random() { return random.nextDouble(); } }