dimanche 16 octobre 2016

Java How to print all Array of Strings, random ,with no duplicates

can you tell me , how to print all array of Strings , randomly , but without duplicates. I dont want to use Lists, Collecton.shuffle.

I try:

String names[] = { "name1", "name2", "name3", "name4", "name5" }; System.out.println(names[rand.nextInt(groupMembers.length - 1)]);

I want to print all names, but shuffled and only once. Something like that:

name4, name1, name2, name5, name3




Aucun commentaire:

Enregistrer un commentaire