Boris Borcic wrote:
> does
>
> x.sort(cmp = lambda x,y : cmp(random.random(),0.5))
>
> pick a random shuffle of x with uniform distribution ?
>
> Intuitively, assuming list.sort() does a minimal number of comparisons to
> achieve the sort, I'd say the answer is yes. But I don't feel quite 
> confortable
> with the intuition... can anyone think of a more solid argumentation ?


Try this:

    x.sort(key=lambda x: random.random())


Raymond

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to