-> 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.
Oooh! Snarky!
No. It has nothing to do with the randomness or otherwise of RND. Your
routine messes up its own randomness by permitting the characters that
have already been randomized to be targets of further swaps.
It's a bit difficult to explain, but easy to demonstrate. Start with a
simple string such as "abc". There are six possible orders into which
the characters can be shuffled, which should occur with equal
frequencies over a long term. So, for example, write a little program
that will do, say, 600 trials, starting with "abc" each time, and will
count the numbers of times the six possible outcomes occur. Of course,
they should each happen 100 times, give or take just a few for random
fluctuations. But, with your routine, they will occur widely different
numbers of times. My routine, on the other hand, will produce each of
the outcomes just about 100 times.
Try it!
dow
--- PCBoard (R) v15.3 (OS/2) 5
---------------
* Origin: FidoNet: CAP/CANADA Support BBS : 416 287-0234 (1:250/710)
|