SeattleWireless
[Blog Home] [Homepage] [Projects] [SeattleWireless] [Email Me] [Resume DOC] [Resume HTML]
Location:

Thu, 13 Dec 2007

One Thousand Monkeys on One Thousand Typewriters

Can one thousand monkeys on one thousand typewriters eventually write a novel? For fun, I decided to put this to the test.

No--I did not fill a warehouse full of monkeys. I used the next best thing: /dev/random. This unix device, or file, can generate a limitless stream of random text and binary for your enjoyment. We are also making /dev/random do something it was not designed to do: produce non-random data.

Conclusion: They probably can't write a novel. But they can write a few words.

If you ever get bored in a shell, and have a lot of computational power at hand, you could try something like this:

cat /dev/random | strings | grep -i wtf\?
wtF?_HO
wtf?

Wow! now that was kinda creepy. Lets gather some statistics...

Use the 'tee' command and try to count just how much useless noise there was before our monkeys typed something of interest:

$ cat /dev/random | tee junk | strings | grep -i wtf\?
Wtf?'
^C
$ wc -c junk
330432512 junk
$

So there you have it. In 330 megabytes of sheer randomness, our monkeys finally asked "wtf?".

You can also try using base64 or uuencode to make /dev/random generate alphabetical characters to increase the odds..

[/funny] permanent link

For past blog entries, check out the archive on the side or click here.


Make some extra cash with your blog too: