RandomSeed test (was:randomly order a list)

dunbarx at aol.com dunbarx at aol.com
Wed May 22 16:46:14 EDT 2013

Sorting by a randomSeed greater than the number of elements of a sample does not help.

With the following in a fld 1:   aaa,bbb,ccc

and this in a button:

on mouseUp
   get fld 1
   repeat  1000
      sort items of it by random(3)
      put it & return after lowSeed
   end repeat
   repeat  1000
      sort items of it  by random(3333)
      put it & return after highSeed
   end repeat
   repeat with y = 1 to the number of lines of lowSeed
      add 1 to lowSeedCounter[line y of lowSeed]
   end repeat
   repeat with y = 1 to the number of lines of highSeed
      add 1 to highSeedCounter[line y of highSeed]
   end repeat
end mouseUp

The distribution of the two groups is about the same. 

Craig Newman

-----Original Message-----
From: Dar Scott <dsc at swcp.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Wed, May 22, 2013 3:59 pm
Subject: Re: randomly order a list

Try replacing 'the number of lines of myVar' with some huge number you think is 
allowed for random(), say 999999.

With small numbers you are likely to get the same number for different lines and 
perhaps sort does not change order in that case. 


On May 22, 2013, at 11:59 AM, Chris Sheffield wrote:

> I have a list of three words that I need to be randomly sorted. To start with, 
the first word is the correct answer to a question. I want to re-order the list 
so that the correct answer may be the second or third word, and not necessarily 
the first. How can I do this successfully every time? The docs give an example 
like this:
> 	sort lines of myVar by random(the number of lines of myVar)
> But this only seems to work successfully one time. After that, the list is 
always set so the first word is the correct answer. So then I tried randomly 
setting the randomSeed value, since this value is supposed to affect the 
random() function and the any keyword, but this didn't seem to make much 
difference except to change it so either the second or third word is *always* 
the right answer. I need it to be more mixed up than that.
> So does anyone have a good way to do this?
> Thanks,
> Chris
> --
> Chris Sheffield
> Read Naturally, Inc.
> www.readnaturally.com

Dar Scott
Dar Scott Consulting
8637 Horacio Place NE
Albuquerque, NM 87111

Lab, home, office phone: +1 505 299 9497
For Skype and fax, please contact.
dsc at swcp.com

Computer programming and tinkering,
usually in supporting those developing in 
LiveCode--typically by making LiveCode 
controls, libraries and externals, and
sometimes by writing associated
microcontroller firmware.  

We can not force our goodwill on anyone, we can only set good examples and hope 
people wish to emulate us. --Ron Paul

use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 


More information about the Use-livecode mailing list