randomly order a list

Dick Kriesel dick.kriesel at mail.com
Wed May 22 20:04:00 EDT 2013

On May 22, 2013, at 10:59 AM, Chris Sheffield <cmsheffield at icloud.com> wrote:

> sort lines of myVar by random(the number of lines of myVar)

Hi, Chris.

I suggest you try this:

sort lines of myVar by _random( the number of lines in myVar, each )

with this:

private function _random pUpperLimit -- note:  ignore other parameters
    return random( pUpperLimit )
end _random

In my test with a million iterations each of the six combinations had almost exactly its fair share.  Does that work for you?

-- Dick

More information about the Use-livecode mailing list