I am making a hangman program for my java class (using the netbeans IDE) and I have, so far, made it write the words from a list on a seperate file and write them into an array. Now I need to find out how to get a random word out of this array. I will post code if you need, just tell me. Thanks in advance guys.

December 15th, 2012, 08:07 PM

Norm

Re: How to get a random item from an array?

Use one of the Random class's methods to return a number from 0 to the array length-1.
Use that number as an index into the array.