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.
  • 91,686
  • 21
  • 171
  • 177

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
  • 19,190
  • 8
  • 63
  • 98
Nambi
  • 11,944
  • 3
  • 37
  • 49