On Thu, Jan 28, 2010 at 5:52 PM, elsa <kerensael...@hotmail.com> wrote:

>        choice = random.choice(range(1,sum([i[0] for i in myList])+1))
>

That's the line causing the problem.  It's generating all of the numbers
between 1 and your sum, then picking one.  Try the following instead, which
will pick a number between 1 and your sum without generating each and every
one.

choice = random.randrange(1, sum(i[0] for i in myList)+1)

--
Daniel Stutzbach, Ph.D.
President, Stutzbach Enterprises, LLC <http://stutzbachenterprises.com>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to