This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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 <1530052341.09.0.56676864532.issue24567@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
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: <1530052341.09.0.56676864532.issue24567@psf.upfronthosting.co.za>
2018-06-26 22:32:21vstinnerlinkissue24567 messages
2018-06-26 22:32:20vstinnercreate