I think the problem comes up when two equal items are compared. I suspect that sort will tend to leave things unchanged.
On May 22, 2013, at 4:31 PM, dunb...@aol.com wrote: > Dar. > > > Yes, the randomseed is misused here. Parameter is better. > > > > I assumed that it made no difference if I sorted the original text, or with a > sorted version of that text. Random is random, right? An example of > shoot-from-the-hip posting to the list. > > > It seems that it does, and I am not sure why. With a low sort parameter, > there is a distinct favoring of the original text, and a distinct disfavoring > of the reverse of that text, The other sorted results are all about where > they should be, 16% of the values. > > > > I am sure there is an explanation for all this. There is definitely something > to what Chris said. The original text occurs far more often than it should. I > think there was discussion about this a while back, and I have forgotten what > the upshot was. > > > Bottom line, though, use a big number. > > > Craig > > > > > -----Original Message----- > From: Dar Scott <d...@swcp.com> > To: How to use LiveCode <use-livecode@lists.runrev.com> > Sent: Wed, May 22, 2013 5:26 pm > Subject: Re: RandomSeed test (was:randomly order a list) > > > There is a potential confusion in the term randomSeed. We might be using it > two > ways. > > There is the randomSeed property, the state of the random number generator. > > And there is the argument to the random function. > > > And... > Shouldn't the 'get fld 1' be inside the loop? (Or initialized the same way > each > time.) You are using the previous sorted 'it' each time. Perhaps that is > what > is doing the scrambling. > > This is my test: > > on mouseUp > set the cursor to watch > put 0 into a1 > put 0 into a2 > put 0 into a3 > put "a" & lf & "b" & lf & "c" into x > repeat 1000000 times > put x into myVar > --sort lines of myVar by random(the number of lines of myVar) > sort lines of myVar by random(999999) > if line 1 of myVar is "a" then add 1 to a1 > if line 2 of myVar is "a" then add 1 to a2 > if line 3 of myVar is "a" then add 1 to a3 > end repeat > put a1 && a2 && a3 into field 1 > end mouseUp > > I got different results depending on which line is commented out. > > Dar > > > On May 22, 2013, at 2:46 PM, dunb...@aol.com wrote: > >> 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 <d...@swcp.com> >> To: How to use LiveCode <use-livecode@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. >> >> Dar >> >> >> On May 22, 2013, at 11:59 AM, Chris Sheffield wrote: > ... >>> >>> sort lines of myVar by random(the number of lines of myVar) >>> > ... >>> >>> -- >>> Chris Sheffield >>> Read Naturally, Inc. >>> www.readnaturally.com >> > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > > > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode