On Feb 1, 9:09 am, Paul McGuire <[EMAIL PROTECTED]> wrote: > 2. Bugfix: In 2 places, change: > newgene=genes[randint(0,14)-1] > to > newgene=genes[randint(0,14-1)] > > randint(a,b) returns values from a to b inclusive, and genes is a list > containing 14 elements (so you want subscripts from 0 to 13). (Using > subscripts from -1 to 13 will bias the selection of genes to use twice > as many of the last item in the list, since both -1 and 13 will give > that value.)
Better yet, use random.randrange: it was added for this very reason, to get a random index in a range. Perhaps even better still, use random.choice. It gets a random element in a sequence. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list