Message246532
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.) |
|
Date |
User |
Action |
Args |
2015-07-09 23:44:35 | vstinner | set | recipients:
+ vstinner, tim.peters, rhettinger, mark.dickinson, pitrou, steven.daprano, r.david.murray, skrah, serhiy.storchaka, Serge Anuchin |
2015-07-09 23:44:35 | vstinner | set | messageid: <1436485475.1.0.697467226568.issue24567@psf.upfronthosting.co.za> |
2015-07-09 23:44:35 | vstinner | link | issue24567 messages |
2015-07-09 23:44:35 | vstinner | create | |
|