Random number generation, simple question.

Kalle Svensson kalle at gnupung.net
Mon Jul 3 10:28:38 EDT 2000


Hello.

I have a few questions about the (pseudo) random number generator supplied
in the standard library. I need 80 random bits (for a CipherSaber IV) but
I hear most RNG's only supply 32 bits or less. My questions are:

 * How many random bits does whrandom.random() generate?

 * Suppose I do a loop where I get a byte at a time and then re-seed the
   generator either with random numbers from the generator or with values
   from time. Will that improve the randomness?

 * Are there better alternatives? I understand I could read from
   /dev/random on Linux, but this isn't portable, and even though I only
   use GNU/Linux myself, I have friends who don't. If anyone can tip me
   off about a similar feature in Win32, I could just detect platform and
   use the appropriate function, of course. I don't think I have to care
   about Macs or other *NIX dialects. Phew... :)

Hope I'm making sense even though I hardly understand what I'm talking
about... :)

TIA,
  Kalle Svensson




More information about the Python-list mailing list