Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #shuffle #string #java
ADD COMMENT
Topic
Name
2+3 =