how to shuffle string java

Solutions on MaxInterview for how to shuffle string java by the best coders in the world

showing results for - "how to shuffle string java"
Silvia
21 Aug 2018
1public static String shuffleString(String string)
2{
3  List<String> letters = Arrays.asList(string.split(""));
4  Collections.shuffle(letters);
5  String shuffled = "";
6  for (String letter : letters) {
7    shuffled += letter;
8  }
9  return shuffled;
10}
11