lundi 14 décembre 2015

im trying to randomly select elements from 3 array of Strings?

I'm trying to randomly select elements from 3 array of Strings?

private static String[] one   ={"dog, cat"};
private static String[] two   ={"ate, ran"};
private static String[] three ={"away, some}"

Random words = new Random();
int index=words.nextInt(one.length+two.length+three.length);

System.out.println(one[index]);




Aucun commentaire:

Enregistrer un commentaire