Java get random string from array/list

https:‮l.www//‬autturi.com
Java get random string from array/list
/**
 * @author lautturi.com 
 * Java example:
 */

import java.util.*;

public class Lautturi {

	public static void main(String args[]) {
		
		String[] arr = { "hello","lautturi","java","python","world" };
		String word1 = arr[(int) (Math.random() * arr.length)];
		System.out.println("get random word from array:"+word1);

		List<String> list = Arrays.asList("hello","lautturi","java","python","world");	
		String word2 = list.get((int) (Math.random() * list.size()));
		System.out.println("get random word from list:"+word2);
	}
}

output:

get random word from array:python
get random word from list:world
Created Time:2017-09-28 14:05:51  Author:lautturi