Descriptionmath/rand: remove noop iteration in Perm
The first iteration always do `m[0], m[0] = m[0], m[0]`, because
`rand.Intn(1)` is 0.
fun note: IIRC in TAOCP version of this algorithm, `i` goes
backward (n-1->1), meaning that the "already" shuffled part of the
array is never altered betweens iterations, while in the current
implementation the "not-yet" shuffled part of the array is
conserved between iterations.
Patch Set 1 #Patch Set 2 : diff -r 6ec24fe2e501 http://code.google.com/p/go #Patch Set 3 : diff -r 6ec24fe2e501 http://code.google.com/p/go #MessagesTotal messages: 5
|