[issue30464] gammavariate has a wrong comment

Raymond Hettinger report at bugs.python.org
Thu May 25 02:24:44 EDT 2017


Raymond Hettinger added the comment:

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

----------
assignee:  -> mark.dickinson

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


More information about the Python-bugs-list mailing list