Tag Archives: random number generator

Displaying Hello World unconventionally by using a Random Number Generator

A very good friend of mine, with whom I enjoy discussing coding techniques, brought to my attention unfamiliar ways of displaying the infamous “Hello World”. Displaying “hello world” is usually the first program anyone tries in a new language.

The code below shows how we can display the said string by the use of a random number generator.


System.out.println(randomString(-229985452) + " " + randomString(-147909649));

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)

        sb.append((char)('`' + k));

    return sb.toString();


How does it work? Well let’s see your best guess. Shouldn’t be that hard.

Original post: