Sorting question
Jeff Massung
massung at gmail.com
Thu Feb 11 09:40:05 CST 2010
On Thu, Feb 11, 2010 at 9:20 AM, <DunbarX at aol.com> wrote:
> Thanks for the responses, but I think there is an issue here.
>
> I figured a sort value was assigned to each item, and certainly a larger
> value of n in random(n) gives, what, more room to move?
>
> Howwever, randomizing, through 1000 iterations, my three items with
> random(3) yields a list heavily weighted in favor of item 1.
>
Because, not all random number generators are created equally...
There's a ton of math behind "random" numbers. Remember, random numbers are
not really random. The term "random" in this context is intended to imply
that the next value in the sequence is unknown.
How evenly distributed (and how often the sequence repeats itself) it
dependent upon what random number generator Rev used in its implementation.
I don't see anything in the dictionary or general documentation that
suggests which is used. It could be anything from the libc implementation of
rand() - which would be a very fast and very poor random number generator -
to something like the Mersenee Twister to generate random numbers (
http://en.wikipedia.org/wiki/Mersenne_twister), which is slow, but produces
good randoms.
Your application's needs will dictate whether or not Rev's random numbers
will work well for you or not.
Jeff M.
More information about the use-livecode
mailing list