tedd wrote: > > > > However, the RND(50) function means that it is returning a number "at > >> random" between 0 and 51 (x>0 AND x<51). It may return, and most > >> probably will return, the same number more than once in 50 calls. As > >> such, then the values of some indexes will be moved to other indexes > >> while others aren't moved at all (rather moved to themselves). It's > >> an interesting solution and was not obvious to me. > >> > >OK, but when a value is not moved, say when index = 1 and the RND > >function returns 1, this doesn't stop the value at index 1 to be > >moved later, say when index = 6 and RND(50) returns 1 again. > >Ingenious, no? > >-- > > > >Cheers > > > >Alain > > Yes, it is ingenious. However, when it is done that way, then there > are other indexes which are not touched. > > No disagreement, just investigating the logic. > Tedd, I know very little about math and I may be wrong but I see it this way: Ideally, each item will have at one time 49 chances out of 50 to be moved (98%), plus (counting all the loops) each item has 49 times 1 chance out of 50 to be eligible for a move. Are we not approaching the certainty? The fact that an item is replaced at its original location at some time shouldn't count. -- Cheers Alain ----------------------------------------------------- FB^3 in Europe: http://euro.futurebasic.com/ FB II Pouch: http://www.pixmix.com/FB/outils.html -----------------------------------------------------