random number between -maxint and +maxint

Dan Parisien dan at eevolved.com
Sun Mar 11 16:24:58 EST 2001


I can't figure out a good way to do it, does anyone know a better solution 
than

from whrandom import whrandom
rand = whrandom()
max = 2**30 + (2**30-1) #one less than 2**31
randomnumber = rand.randrange(0, max) - rand.randrange(0, max)

thank you for your time,
Dan



More information about the Python-list mailing list