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

-> I did and you're right! However, you're not 100% right. REM out line
-> 2040 and see what happens. You'll find that it isn't the whole
-> routine
-> but only the code that does not allow a character to be swapped with
-> itself. Logically that doesn't make any sense. In order for the
-> routine
-> to work well it must include the possibilty of exchanging a character
-> with itself! I haven't studied it enough to see why it does what it
-> does.  (If anyone knows the answer I would like to know!) I did
-> however
-> learn something. Thank you!
Hmmm... Interesting! Of course, swapping a character with itself is a
"null operation", that does nothing. However, REMing out that line has
another effect, it prevents the generation of a new random number and
the swapping of the character with the one thereby specified. So,
whereas your original coding forced a "real " (i.e. non-null) swap to
occur, the modified coding permits the null operation.
Yes, I can see that this may improve your routine somewhat. However, I
still don't believe it will turn out to be truly random, giving equal
(long-term) frequencies to the generation of each of the six possible
permutations.
Think about this: In its modified form, your routine does three swaps,
each of which can have three outcomes (including the null one). So there
are 3^3, i.e. 27, different and equi-probable "routes" that can be taken
through a kind of decision tree. But there are only six different
possible outcomes. So several of the routes must lead to identical
outcomes. Okay. So far, so good. But it is impossible for 27 routes to
be equally divided among the six outcomes, since 6 is not an exact
factor of 27. Therefore some of the outcomes must be reached by more
routes than some of the others, and therefore be more probable.
If you think about it, my routine involves a decision tree with N! (N
factorial) branches, each of which leads to one of the N! outcomes. So
the outcomes are equally probable.
Anyway, I'll make the change (REMing that line) and also increase T to a
larger value, to show up smaller variations in frequency. I bet this
will show that your routine still produces different frequencies for the
outcomes!
                               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™.