Skip to content

Instantly share code, notes, and snippets.

@kevinslin
Created March 8, 2013 13:43
Show Gist options
  • Save kevinslin/5116515 to your computer and use it in GitHub Desktop.
Save kevinslin/5116515 to your computer and use it in GitHub Desktop.
#java #cool "Random" Hello world
// source: http://stackoverflow.com/questions/15182496/why-does-this-code-print-hello-world?newsletter=1&nlcode=83359%7c512e
System.out.println(randomString(-229985452) + " " + randomString(-147909649));
public static String randomString(int i)
{
Random ran = new Random(i);
StringBuilder sb = new StringBuilder();
for (int n = 0; ; n++)
{
int k = ran.nextInt(27);
if (k == 0)
break;
sb.append((char)('`' + k));
}
return sb.toString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment