Size of integers (2**32-1)

Thomas Guettler st-newsgroups at thomas-guettler.de
Tue Feb 5 04:53:53 EST 2002


Paul Rubin wrote:

> Thomas Guettler <st-newsgroups at thomas-guettler.de> writes:
> 
> 
>>I have two python version installed:
>>with the cygwin version "print 2**32-1" works
>>but with the zope version I get OverFlowError.
>>
>>Background:
>>I want to get a random 32-Bit integer like this randrange(0, 2*32-1)
>>
> 
> Values of sys.maxint must be different.  Try: randrange(0,2147483647).
> 

The module random contains a lot of functions. I think getting a random 
32 random number is needed often.

randrange(0,2147483647) is not a 32 Bit random number because
  2**32-1 is 4294967295.







More information about the Python-list mailing list