Random number generation, simple question.

Suchandra Thapa ssthapa at midway.uchicago.edu
Wed Jul 5 14:22:43 EDT 2000


Kalle Svensson <kalle at gnupung.net> wrote:
>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?

    This may not be entirely wise.  An psuedo-random number generator
eventually cycles and starts repeating.  The problem is that the seed
supplied to the prng affects how quickly it loops and the distribution
of the numbers the prng generates.  If you feed random numbers into 
the prng youo could end up with weaker encryption than you think. 


-- 
------------------------------------------------------------------

Suchandra S. Thapa 
s-thapa at uchicago.edu

------------------------------------------------------------------



More information about the Python-list mailing list