import java.util.Collections; import java.util.List; import java.util.Arrays; public class Shuffler { public static void main(String []args){ String s = "012345"; for( int i = 0; i < 10; i++) { System.out.println(shuffle(s)); } } public static String shuffle(String s) { List<String> chars = Arrays.asList(s.split("")); Collections.shuffle(chars); return String.join("", chars); } }
No comments:
Post a Comment