[ python-Bugs-1675516 ] random.randint fails on lists

SourceForge.net noreply at sourceforge.net
Wed Mar 7 09:10:19 CET 2007


Bugs item #1675516, was opened at 2007-03-07 08:10
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1675516&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: sardonics (sardonics)
Assigned to: Nobody/Anonymous (nobody)
Summary: random.randint fails on lists

Initial Comment:
>>> for i in range(400):
... 	l[random.randint(0,7)]
... 	
'g'
'g'
'c'
'c'
'b'
'b'
'g'
'g'
'd'
'g'
'd'
'f'
'd'
'a'
Traceback (most recent call last):
  File "<interactive input>", line 2, in ?
IndexError: list index out of range
>>> l
['a', 'b', 'c', 'd', 'e', 'f', 'g']
>>> 

have no idea what the problem is. check out the error though

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1675516&group_id=5470


More information about the Python-bugs-list mailing list