Answers for "how to shuffle string java"

0

how to shuffle string java

public static String shuffleString(String string)
{
  List<String> letters = Arrays.asList(string.split(""));
  Collections.shuffle(letters);
  String shuffled = "";
  for (String letter : letters) {
    shuffled += letter;
  }
  return shuffled;
}
Posted by: Guest on December-24-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language