为什么这个使用随机字符串的代码打印“hello world”?
以下打印语句将打印“hello world”。谁能解释一下?
System.out.println(randomString(-229985452) + " " + randomString(-147909649));
看起来像这样:randomString()
public static String randomString(int i)
{
Random ran = new Random(i);
StringBuilder sb = new StringBuilder();
while (true)
{
int k = ran.nextInt(27);
if (k == 0)
break;
sb.append((char)('`' + k));
}
return sb.toString();
}