import java.util.Scanner; import java.io.File; /** Picking a random word out of the dictionary. */ class Main {//M public static void main(String[] args) { //main int secretLocation = getRandom(172000); int count = 0; Scanner dictionary; String secretWord = ""; String s = ""; try {//t dictionary = new Scanner( new File("words.txt")); while ( dictionary.hasNext() ) { //w s = dictionary.next(); count++; if ( count == secretLocation ) { secretWord = s; break; } } //w System.out.println("Secret word: " + secretWord); } //t catch (Exception e) { //c System.out.println("file not found"); } //c } //main //allows use to receive a random number public static int getRandom( int max ) {//g return (int) (Math.random() * max); } //g }//M