This is a direct implementation of an Idea from John Graham-Cuming, plus a few improvements.
I found that a naive random character generator generate special characters too often. That makes passwords typing really tedious. So, I took the liberty to skew the probabilities. Of course, that hurts entropy, but not much.
How to use it
Download the C file, compile it, then run the executable. It reads the random seed from the standard imput, and writes a nice square of random characters to the standard output.
$ gcc passgen.c -o passgen.out $ ./passgen.out </dev/urandom