Skip to content

Instantly share code, notes, and snippets.

@brendanberg
Created October 27, 2011 15:34
Show Gist options
  • Save brendanberg/1319909 to your computer and use it in GitHub Desktop.
Save brendanberg/1319909 to your computer and use it in GitHub Desktop.
Can you guess the output?
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();
}
@brendanberg
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment