This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: sync-up gammavariate and expovariate code
Type: performance Stage: resolved
Components: Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: leodema, rhettinger
Priority: normal Keywords:

Created on 2017-06-03 20:16 by leodema, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 1934 merged leodema, 2017-06-03 20:45
PR 1798 leodema, 2017-06-03 20:49
Messages (2)
msg295102 - (view) Author: Leonardo De Marchi (leodema) * Date: 2017-06-03 20:16
As suggested by rhettinger in http://bugs.python.org/msg294438:

I agree that the comment should be changed. While we at it, perhaps sync-up with expovariate() code and eliminate the ``u <= 1e-7`` test:

Instead of:

        elif alpha == 1.0:
            # expovariate(1)
            u = random()
            while u <= 1e-7:
                u = random()
            return -_log(u) * beta

Use this instead:

        elif alpha == 1.0:
            # expovariate(1.0 / beta)
            return -_log(1.0 - random()) * beta
msg332481 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2018-12-24 16:17
New changeset 63d152232e1742660f481c04a811f824b91f6790 by Raymond Hettinger (leodema) in branch 'master':
bpo-30561: Sync-up expovariate() and gammavariate code (GH-1934)
https://github.com/python/cpython/commit/63d152232e1742660f481c04a811f824b91f6790
History
Date User Action Args
2022-04-11 14:58:47adminsetgithub: 74746
2018-12-24 16:17:04rhettingersetmessages: + msg332481
2018-12-24 06:55:58rhettingersetstatus: open -> closed
resolution: fixed
stage: resolved
2017-06-09 20:50:41terry.reedysetnosy: + rhettinger
2017-06-03 20:49:10leodemasetpull_requests: + pull_request2014
2017-06-03 20:45:40leodemasetpull_requests: + pull_request2011
2017-06-03 20:16:30leodemacreate