Random algorithm
John Vokey
vokey at uleth.ca
Thu Nov 13 00:11:03 EST 2008
All,
<rant>
This has bugged me for a long time (back to the days of the Apple //,
at least). All programming languages should *document* their RNGs, so
we have some idea of what they are, and, especially, how bad they are
(and most are very bad). LGN RNGs are not necessarily bad (a
colleague and I developed some quite good ones, back in the day: <http://www.kaner.com/pdfs/random.pdf
>, but, as Marsaglia has documented more recently, we can do so much
better. If you want the Rev (actually, old hypercard) code for my and
Kaner's LNG RNGs, I can send it to you, but it is recursive (it
replaces itself in place), so can only be used in the IDE or Rev
Player (or any variant that doesn't render the RNG stack as a
standalone).
But, the better principle is the more RNGs (even bad ones) the
better. Then, as Marsaglia demonstrated, simply *combine* them in
some way: e.g., use RNG 1 to choose which of n RNGs you choose from
next, use the result of that second RNG to select among the remaining
n-1, and so on, until you get a number. Even a collection of bad RNGs
will produce quite random numbers under Marsaglia's insight.
</rant>
On 12-Nov-08, at 6:38 PM, use-revolution-request at lists.runrev.com wrote:
> Many thanks for your two cents !
>
> I wonder if the first name of people answering my first question is
> really random : Mark, Mark and Mark...
>
> Jacques
More information about the use-livecode
mailing list