2012-11-03 57 views

回答

2
List<String> list = new ArrayList<String>(); 
list.add(...); 
list.add(...); 
list.add(...); 
Random rand = new Random(); 
String random = list.get(rand.nextInt(list.size())); 

或:

Collections.shuffle(list); 
String random = list.get(0);