difference between random module in python 2.6 and 3.2?
storchaka at gmail.com
Tue Feb 7 05:05:35 EST 2012
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.
More information about the Python-list