Rich Marinaccio added the comment:
I have been using python for Civilization IV map scripting, and I
believe I have found a small problem with the randint function. Once in
a blue moon, randint(a,b) returns b + 1, rather than a <= N <= b. I
have seen this behavior a few times. Here is the code I used to
determine this.
randIndex = PWRand.randint(0,len(preshuffle)-1)#PWRand calls randint
directly with these parameters
if randIndex < 0 or randIndex >= len(preshuffle):
raise ValueError, " bad index shuffling plot list randIndex=%(r)d
listLength=%(l)d, mapSize=%(s)d" % {"r":randIndex,"l":len
(preshuffle),"s":hm.mapWidth*hm.mapHeight}
#output is
ValueError: bad index shuffling plot list randIndex=1453
listLength=1453, mapSize=13824
according to the docs, the max randIndex should be listLength - 1
__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1704>
__________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com