-> Record running water and mix it with tv noise. Then digitize this and
-> use it to scramble the characters like this... ;-)
....
-> Maybe this is random (I'm not a mathe wiz), but IF... it would be an
-> 'overkill routine' just to scramble three characters! ;-)
Well, sure, there are ways of generating random numbers that depend on
physical phenomena, rather than the mathematical algorithms that are
used by things like RND. Radioactive decays, which physicists believe
are *absolutely* random - i.e. incapable of exact prediction no matter
how much information is known about the physical situation -, are used
in some circumstances. And, yes, it would be possible to use these to
scramble the characters in a string, or anything similar.
Whether it's "overkill" depends on how important the results are. If
you just want to play games at home, it may not matter if some results
come up much more often than others. But if you're running a lottery,
with huge amounts of money at stake, you'd better be sure that there is
no non-randomness in your numbers, since if there is people could use it
to "break the bank" - i.e. put your organization into bankruptcy.
But...
-> RANDOMIZE TIMER
-> OPEN "WATER.RAW" FOR BINARY INPUT AS #1 ' the sample e.g. 500.000
-> bytes FOR I=1 TO 25
-> F=0 WHILE F=0 X=INT(RND*1000)+2
-> GET$ 1,X,B$ ' get 'random' number of bytes
-> X=ASCII(RIGHT$(B$,1)) AND 3 ' make byte 0-3
-> Y=ASCII(LEFT$(B$,1)) AND 3 ' "
-> IF X>0 AND Y>0 AND XY THEN ' delete XY if you want ;-)
-> F=1
-> END IF
-> WEND Temp$=MID$(Text$,X,1) MID$(Text$,X,1)=MID$(Text$,Y,1)
-> MID$(Text$,Y,1)=Temp$ NEXT I
-> CLOSE#1
-> END
The fact that you're generating your "random" numbers, X and Y, by some
physical method, instead of by using RND, does *not* evade the fact that
your calculations are *fundamentally* flawed, in the same way as Robert
Fortune's. You're doing 25 swaps, each of which depends on two "random"
numbers in the range 1 to 3. So the total number of branches in the
decision tree is 9^25. Since all powers of 9 are odd numbers, and all
multiples of 6 are even, there is no way in which equal numbers of
branches can go to each of the six possible permutations of three
characters. So the permutations must *not* be (exactly) equi-probable,
no matter how your "random" numbers are generated.
-> Just to put some oil in the flames...
More like a red herring...
dow
--- PCBoard (R) v15.3 (OS/2) 5
---------------
* Origin: FidoNet: CAP/CANADA Support BBS : 416 287-0234 (1:250/710)
|