Random 32Bit integer was: Size of integers (2**32-1)

Thomas Guettler st-newsgroups at thomas-guettler.de
Tue Feb 5 05:34:18 EST 2002


Gerhard Häring wrote:

> Le 05/02/02 à 10:16, Thomas Guettler écrivit:
> 
>>I have two python version installed:
>>with the cygwin version "print 2**32-1" works
>>but with the zope version I get OverFlowError.
>>
> 
> Zope uses Python 2.1, while your Cygwin Python is 2.2, right?


yes

[cut]

> Btw. it looks like random.randint/randrange really want ints and won't
> accept longs. A workaround could be to use a construction like:
> 
>     print random.randrange(0, sys.maxint) * 2L


This would give me a long. But I need a 32Bit Integer.
Unfortunately there is no sys.minint.

OK, it is not that important for me. But it would be nice to know
the answer (How to get a radom 32 Bit integer)

thomas






More information about the Python-list mailing list