Message246532
| 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: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 | |