-> SUB Scramble (Text$)
-> IF LEN(Text$)>1 THEN ' string must be at least 2 chars
-> L=LEN(Text$) ' number of chars in string
-> FOR I=1 TO L+L ' exchange 2 times len of text
-> X=1+INT(RND*L) ' pick a random char
-> Y=1+INT(RND*L) ' pick a second random char
-> C$=MID$(Text$,X,1) ' save original char 1 (X)
-> MID$(Text$,X,1)=MID$(Text$,Y,1)' exchange char 1 with char 2 (Y)
-> MID$(Text$,Y,1)=C$ ' put char 1 at position of char
-> 2
-> NEXT I ' till 25 (or more...) times
-> END IF END SUB ' done - exit subroutine
I doubt very much whether this will produce truly random results,
either.
dow
--- PCBoard (R) v15.3 (OS/2) 5
---------------
* Origin: FidoNet: CAP/CANADA Support BBS : 416 287-0234 (1:250/710)
|