(Just to be clear, I wasn't trying to suggest this as more than an ad-hoc solution for a throwaway script. But to me, "sorted by random key" is almost as obvious as "shuffled", perhaps more so for non english speakers with little background in CS terms; the words "sorted" and "random" jumps to the eye, and sometimes you don't need more than that) ~Elazar
בתאריך יום ג׳, 6 בספט' 2016, 21:48, מאת Bernardo Sulzbach < mafagafogiga...@gmail.com>: > On 09/06/2016 03:37 PM, Sven R. Kunze wrote: > > > > Besides being a silly argument, it's an interesting solution. > > > > Does it really work? I remember Microsoft utilizing a similar approach > > for their browser selection tool which led to a skewed probability > > distribution. Maybe, I wrong here though. > > > > Yes. The key is evaluated only once, so each element gets a > pseudo-random number. Sorting this list leads to a shuffle. > > However, a super-linear shuffle, whilst Fisher-Yates is a linear > solution and also requires less additional memory. > > Lastly, although it is obvious, from a software engineering standpoint, > this is a mere weird hack. > > _______________________________________________ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/