TIP: Click on subject to list as thread! ANSI
echo: power_bas
to: DAVID WILLIAMS
from: ROBERT FORTUNE
date: 1997-09-12 18:39:00
subject: Scramble

RF> SUB Scramble (Word$)
RF> LOS% = LEN(Word$)       ' the Length Of String passed
RF> IF LOS% < 3 THEN        ' added 9/12/1997
RF>    PRINT "String\word too short!"
RF>    EXIT SUB
RF> END IF
RF> FOR I% = 1 TO LOS%
RF>   DO
RF>    SP% = INT(RND * LOS%) + 1   ' swap pointer (into the Word$ string)
RF>   LOOP UNTIL SP%  I%         ' no sense swapping character with self
RF>   Temp$ = MID$(Word$, I%, 1)   ' store this character temporarily
RF>   MID$(Word$, I%, 1) = MID$(Word$, SP%, 1)  ' and do the swap
RF>   MID$(Word$, SP%, 1) = Temp$  ' reassign char from stored temp char
RF> NEXT I%
RF> END SUB
DW>Nope. This does, indeed, scramble the word, but *not* into a strictly
DW>random order. If you do it a large number of times, you will find that
DW>some output orders come up more often than others.
   Nonsense. Your version is no better than mine or the other one that
   was posted weeks ago. And I will not be drawn into that useless debate
   on how random computer randomness is. If that is your intention, don't
   bother.
DW>I just posted a message with a "proper" way to do it.
   And see my *proper* reply to that.
-Robert Fortune
 * OLX 2.1 TD * Jesus loves you.  Everyone else thinks you're an idiot.
--- PCBoard (R) v15.3/M 10
---------------
* Origin: MoonDog BBS þ RIME NetHub Brooklyn,NY (1:278/15)

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™.