The standard does not specify the algorithm that must be used
(it only places requirements on the complexity ... (last-first-1 swaps)).
I suspect that the Knuth shuffle is used.
http://en.wikipedia.org/wiki/Knuth_s...ing_algorithms
Printable View
The standard does not specify the algorithm that must be used
(it only places requirements on the complexity ... (last-first-1 swaps)).
I suspect that the Knuth shuffle is used.
http://en.wikipedia.org/wiki/Knuth_s...ing_algorithms
It appears to work its way through the container from first to last, exchanging the current item with one randomly selected from the items iterated so far, excluding the first one.
Thanks for your help.