3 ms·
It's not random; the mean value for the first half of the new list (originally [0,1,2,3,4,5,6,7,8,9]) is 10, while the mean for the second half is 35. (Or at
by jjs 17y ago
It's not random; the mean value for the first half of the new list (originally [0,1,2,3,4,5,6,7,8,9]) is 10, while the mean for the second half is 35.
(Or at least, it came out that way reliably after several runs of a million iterations each time).
Since a value sorted this way has a decreasing chance to be swapped an increasing number of positions, this result makes perfect sense.