Author vstinner
Recipients Serge Anuchin, mark.dickinson, pitrou, r.david.murray, rhettinger, serhiy.storchaka, skrah, steven.daprano, tim.peters, vstinner
Date 2015-07-09.23:44:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1436485475.1.0.697467226568.issue24567@psf.upfronthosting.co.za>
In-reply-to
Content
Again, why not using only integers?

Pseudo-code to only use integers:

def randint(a, b):
    num = b - a
    if not num:
        return a
    nbits = (num + 1).bit_length()
    while True:
        x = random.getrandbits(nbits)
        if x <= num:
            break
    return a + x

(It doesn't handle negative numbers nor empty ranges.)
History
Date User Action Args
2015-07-09 23:44:35vstinnersetrecipients: + vstinner, tim.peters, rhettinger, mark.dickinson, pitrou, steven.daprano, r.david.murray, skrah, serhiy.storchaka, Serge Anuchin
2015-07-09 23:44:35vstinnersetmessageid: <1436485475.1.0.697467226568.issue24567@psf.upfronthosting.co.za>
2015-07-09 23:44:35vstinnerlinkissue24567 messages
2015-07-09 23:44:35vstinnercreate