inFileName="#wordList#"; inFile=createObject("java","java.io.RandomAccessFile").init(inFileName,"r"); randomWord=""; while(randomWord eq "" ) { randomPos=randRange(0,inFile.length()); // Move the file pointer to a random location in the file. inFile.seek(randomPos); // Read from file pointer to the first EOL that we find inFile.readLine(); // The above read may be only a partial line. We will now read from the previous // EOL to the next line's EOL. This should give us a full line. randomWord=inFile.readLine(); }