Last active
August 29, 2015 14:16
-
-
Save ldub/1d1445841dc3e92ecacc to your computer and use it in GitHub Desktop.
ShuffleOneLine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.BufferedReader; | |
| import java.io.InputStreamReader; | |
| public class Shuffle { | |
| public static void main(String[] args) { | |
| String str = "shuf_ftw"; | |
| try { | |
| String shuffled = (new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec(new String[] { "sh", "-c", "echo " + str + " | fold -w1 | shuf | tr -d '\n'" }).getInputStream()))).readLine(); | |
| System.out.println(shuffled); | |
| } catch (Exception e) {} | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment