Stop using math/rand.

Use a real PRNG instead.

Fixes #1.