On Aug 24, 9:30 pm, Mark Dickinson <[EMAIL PROTECTED]> wrote: > x = floor((n/2**53)*7) > > will produce 0, 1, 3 and 5 with probability (2**53//7+1)/2**53, and 2, > 4 and 6 with probability (2**53//7)/2*53.
Oops---I lied; I forgot to take into account the rounding implicit in the (n/2**53)*7 multiplication. A bit of experimentation shows that it's 0, 2, 4 and 6 that occur more often, with 1, 3 and 5 less likely by a miniscule amount (at least on an IEEE-754 system). Mark -- http://mail.python.org/mailman/listinfo/python-list