How do I generate cryptographically random numbers on OSX?

Solution 1:

The /dev/random file on OS X is fairly good since it uses the Yarrow algorithm which many consider to be fairly secure in generating random numbers.

You can use dd to pull a character at a time off the stream and as long as you use caution in converting it into a number range you care to see in your text file, this is a fairly painless way to get some decent randomness.

dd if=/dev/random bs=1 count=1 2>/dev/null >> /path/to/your/file