[New-bugs-announce] [issue30561] sync-up gammavariate and expovariate code

Leonardo De Marchi report at bugs.python.org
Sat Jun 3 16:16:30 EDT 2017


New submission from Leonardo De Marchi:

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

----------
messages: 295102
nosy: leodema
priority: normal
severity: normal
status: open
title: sync-up gammavariate and expovariate code
type: performance

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30561>
_______________________________________


More information about the New-bugs-announce mailing list