TIP: Click on subject to list as thread! ANSI
echo: power_bas
to: MARVIN STAHL
from: DAVID WILLIAMS
date: 1997-09-10 19:05:00
subject: Re: Scramble

-> 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)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.