[snip]
Dar Scott writes:
On the final pass, the value of element 2 is swapped with the value of element 1.
This scrambling idea is a good idea and is especially applicable to situations where the swap can be done in constant time as in scrambling characters. I think the random n of n can be generalized to random n of m.
I don't think the above quoted statement is exactly right, though. It looks to me that on the final pass element 1 is swapped with element 1. On the penultimate pass, element 2 is swapped with either element 1 or element 2. Of course, the penultimate can be made the final as the final doesn't do anything. This comment is intended only as clarification; the method looks great to me.
Allowing R to be i (causing a trivial swap) is crucial and is part of the merit of the method.
Dar Scott
My error regarding the final pass description. You are correct about the final and penultimate swaps as you described. Although the final swap is
a trivial swap of element 1 with itself, I left it to avoid another line of code.
miscdas
_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to