Random but unique

Dar Scott dsc at swcp.com
Sun Jan 12 14:09:01 EST 2003


On Sunday, January 12, 2003, at 01:24 AM, miscdas at boxfrog.com wrote:

> 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




More information about the use-livecode mailing list