07.02.12 00:06, Matej Cepl написав(ла):
> return seq[int(random.random() * len(seq))]
> 
> doesn't seem like something so terrible (and maintenance intense). :)

_choice('abc') returns 'a' with probability P('a') = 
1501199875790165/4503599627370496 = 1/3 - 1/13510798882111488 and 'b' with 
probability P('b') = 3002399751580331/9007199254740992 = 1/3 + 
1/27021597764222976. P('b') - P('a') = 1/9007199254740992.

This may be acceptable for your application, but for applications that are 
concerned not only about the repeatability of results, but the accuracy and 
consistency with the results obtained by other (not Python) applications, it is 
better to get rid of such a notorious bias.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to