[issue24567] random.choice IndexError due to double-rounding

STINNER Victor report at bugs.python.org
Sun Jul 5 12:36:51 CEST 2015


STINNER Victor added the comment:

There is a simple fix. If the result is invalid, drop it and generate a new
number. It should keep the distribution uniform.

Another fix is to only use integers. Why do we use float in choice by the
way?

----------

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


More information about the Python-bugs-list mailing list