/** * Function Name: randomWord * * @return String words[index]; * * Inside the Function * 1. numWord variables contains words length * 2. Math.random method to get a random numbers * 3. multiply both to get random index */ public static String randomWord(){ int numWords = words.length; double randomWord = Math.random(); int randomIndex = (int)(randomWord *numWords); return words[randomIndex]; }