But from googling around I see that /dev/random can block fairly quickly, after only a handful of numbers :-(
You can solve this by using /dev/urandom instead, as Jerome have said already.
Is something equivalent available on Windows?
There's CryptGenRandom.