-> SUB Scramble (Word$)
-> LOS% = LEN(Word$) ' the Length Of String passed
-> FOR I% = 1 TO LOS%
-> DO SP% = INT(RND * LOS%) + 1 ' swap pointer (into the Word$ string)
-> LOOP UNTIL SP% I% ' no sense swapping character with self
-> Temp$ = MID$(Word$, I%, 1) ' store this character temporarily
-> MID$(Word$, I%, 1) = MID$(Word$, SP%, 1) ' and do the swap
-> MID$(Word$, SP%, 1) = Temp$ ' reassign char from stored temp
-> character NEXT I%
-> END SUB
Nope. This does, indeed, scramble the word, but *not* into a strictly
random order. If you do it a large number of times, you will find that
some output orders come up more often than others.
I just posted a message with a "proper" way to do it.
dow
--- PCBoard (R) v15.3 (OS/2) 5
---------------
* Origin: FidoNet: CAP/CANADA Support BBS : 416 287-0234 (1:250/710)
|