Rich Marinaccio added the comment:
What was happening before was I was getting an index out of range error
every so often, so then I put in the ValueError catch to see what was
going on. I was surprised to see that randIndex was the same as len
(preshuffle). I have some further catches in
Rich Marinaccio added the comment:
To be clear, I am not using multi-threading in my particular module. I
can't explain this behavior with my code alone. The issue is
complicated by the fact that my module is called by Civ IV, and I have
no idea what the game is doing behind the scen
Rich Marinaccio added the comment:
I've done some more testing and I can't get this to repeat with randint
alone. It must be an issue with combination of the len() function used
as a parameter to randint. The above code is in a loop that further
down will del preshuffle[randIndex].
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
New submission from Rich Marinaccio:
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