public static String shuffle ( final String value ) { validate ( value , NULL_STRING_PREDICATE , NULL_STRING_MSG_SUPPLIER ) ; String [ ] chars = chars ( value ) ; Random random = new Random ( ) ; for ( int i = 0 ; i < chars . length ; i ++ ) { int r = random . nextInt ( chars . length ) ; String tmp = chars [ i ] ; chars [ i ] = chars [ r ] ; chars [ r ] = tmp ; } return Arrays . stream ( chars ) . collect ( joining ( ) ) ; }
It returns a string with its characters in random order .