Hi, new here but would appreciate some sort of help.
I have to create a program that takes 20 random strings from a string array of 40 words I made, and store them into a new string array called second. Directions:
-create random # generator
-generate random # between 0 – 39
-take first[random#] store it into second
-strings[20] holds random strings (second)
So my problem is I don't know how to take the 20 random numbers, and store them, and than convert them back into 20 words from the original array. Any help would be appreciated. Thanks in advance.
public class stringTest
{
public static void main(String[] args)
{
String [] words = {"animal","Awesome","Bachelor","bird","beach","cat","Crazy","dominate","dad","Dip","Polish","peach","Zebra","xylophone","Hat","juice","pillow","whale","Kite","juggle","use","Upset","Happy","sad","Huge","tiny","Miniscule","clown","Trapeze","cry","lollipop","Sucker","Monitor","Keyboard","mouse","window","lamp","Video","paper","Telephone"};
Random num = new Random();
for (int i = 0; i < 20; i++)
{
int number = num.nextInt(39);
String [] second = number;