1

Is there any built in function to shuffle contents of String array in java/android?

For example, To shuffle array a.

a[4]={"abc","cde","def","ghi"}
Alexis C.
  • 87,500
  • 20
  • 164
  • 172

1 Answers1

1

try Collections.shuffle() in java to shuffle the elements inside the array

Collections.shuffle( a);
for (String i : a) {
    System.out.println(i);
}
Simulant
  • 18,114
  • 7
  • 59
  • 94
Nambi
  • 11,766
  • 3
  • 35
  • 49