消息 [108101]
Here's an example patch that removes any bias from randrange(n) (except for bias resulting from the imperfectness of the core MT generator). I added a small private method to Modules/_randommodule.c to aid the computation.
This only fixes one instance of int(random() * n) in the Lib/random.py source; the other instances should be modified accordingly.
With this patch, randrange is a touch faster than before (20-30% speedup) for small arguments.
Is this worth pursuing? |
|
| 日期 |
用户 |
动作 |
参数 |
| 2010-06-18 12:22:12 | mark.dickinson | 修改 | recipients:
+ mark.dickinson, rhettinger |
| 2010-06-18 12:22:12 | mark.dickinson | 修改 | messageid: <1276863732.9.0.202368142527.issue9025@psf.upfronthosting.co.za> |
| 2010-06-18 12:22:11 | mark.dickinson | 链接 | issue9025 messages |
| 2010-06-18 12:22:11 | mark.dickinson | 创建 | |
|