How about something like this:
String getRandomString(List<String> list) {
return list.get(new Random().nextInt(list.size()));
}
This isn’t the most efficient way, but should do the job.
5
solved Return method return several times [closed]
How about something like this:
String getRandomString(List<String> list) {
return list.get(new Random().nextInt(list.size()));
}
This isn’t the most efficient way, but should do the job.
5
solved Return method return several times [closed]