Created
October 27, 2011 15:34
-
-
Save brendanberg/1319909 to your computer and use it in GitHub Desktop.
Can you guess the output?
This file contains 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
public static void main(String ... args) { | |
System.out.println(randomString(-229985452)+' '+randomString(-147909649)); | |
} | |
public static String randomString(int seed) { | |
Random rand = new Random(seed); | |
StringBuilder sb = new StringBuilder(); | |
for(int i=0;;i++) { | |
int n = rand.nextInt(27); | |
if (n == 0) break; | |
sb.append((char) ('`' + n)); | |
} | |
return sb.toString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Taken from here: http://vanillajava.blogspot.com/2011/10/randomly-no-so-random.html