Author vstinner
Recipients Serge Anuchin, mark.dickinson, pitrou, r.david.murray, rhettinger, serhiy.storchaka, skrah, steven.daprano, tim.peters, vstinner
Date 2018-06-26.22:32:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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?
Date User Action Args
2018-06-26 22:32:21vstinnersetrecipients: + vstinner, tim.peters, rhettinger, mark.dickinson, pitrou, steven.daprano, r.david.murray, skrah, serhiy.storchaka, Serge Anuchin
2018-06-26 22:32:21vstinnersetmessageid: <>
2018-06-26 22:32:21vstinnerlinkissue24567 messages
2018-06-26 22:32:20vstinnercreate