There are 3 groups of words (0-2) with lengths:
0: 3-6 Low difficulty
1: 7-10 Medium difficulty
2: 11-14 High difficulty
Data array with words in order based on difficulty level:
[0,1,2,
0,1,2,
0,1,2,
...]
String[] wordsList = new String[]{
"Dog", // 3
"Adventure", // 9
"Pronunciation", // 13
...}
How to randomly pick word from array based on difficulty level?
if (diff == 0) word =
should be wordsList[0]
or wordsList[3]
or wordsList[6]
...
I tried this but it did not work:
int diff = 0;
String word = wordsList[new Random().nextInt(wordsList.length/3) + diff];
Aucun commentaire:
Enregistrer un commentaire