STINNER Victor <[email protected]> added the comment:
Let me see random_double_round.diff.
In master:
def shuffle(self, x, random=None):
"""Shuffle list x in place, and return None.
Optional argument random is a 0-argument function returning a
random float in [0.0, 1.0); if it is the default None, the
standard random.random will be used.
"""
This method has a weird API. What is the point of passing a random function,
whereas shuffle() is already a method of an object which generates random
numbers?! The bug only affects the case when random is set. I proposed to
deprecate this argument and remove it later.
return [population[_min(_int(random() * total), total)]
for i in range(k)]
Why not using _randbelow() here? For speed according to:
> some variant of `int(random() * someinteger)` is being used in an inner loop
> for speed.
Why not optimizing _randbelow() in this case? Like implementing it in C?
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue24567>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com