This script demonstrates what is going on with random sorts of short lists
using this:
sort items of myVar by random( the number of items of myVar)
This is a button script on a stack with a wide field with a scrollbar.
local lineAssignments
on mouseUp
set the cursor to watch
put
Thanks, Dar, now I understand !
Till yesterday evening, I always used the numeric result of random(tUpperlimit)
to de-sort chunks of text, being not aware of the use of function's
combination like sort lines of […] random(xxx).
… and at least my scripts worked exactly as I expected !
IMHO,
On May 23, 2013, at 12:41 AM, Jacques Hausser jacques.haus...@unil.ch wrote:
and something like
scramble lines of myVar, instead of sort lines of myVar random(xxx).
Could be a command using the same function behind the scene, with the max
integer as parameter to avoid prevalence of the
Yes shuffle is better - a penchant for gambling instead of a taste of eggs ;-)
Jacques
Le 23 mai 2013 à 10:24, Dick Kriesel dick.krie...@mail.com a écrit :
On May 23, 2013, at 12:41 AM, Jacques Hausser jacques.haus...@unil.ch wrote:
and something like
scramble lines of myVar, instead
What sort does is very general. At first it looks like you put a chunk
selector after 'by' in sort. Then we see things like random(99). That can
be confusing.
What goes after 'by' is any expression. We can call it
blah-blay-blah-maybe-including-each.
We might imagine this function
Dick Kriesel wrote:
command shuffle @rLines
sort rLines by random( 4294967295 ) -- note: 2^32-1
end shuffle
Wouldn't that put the probability of sorting bottom-to-top unusually
high, since there the odds are 4294967292-to-1 that the sort integer
will exceed the number of lines in the
On Thu, May 23, 2013 at 6:51 AM, Richard Gaskin
ambassa...@fourthworld.com wrote:
Wouldn't that put the probability of sorting bottom-to-top unusually high,
since there the odds are 4294967292-to-1 that the sort integer will exceed
the number of lines in the list?
If I'm reading the prior
On Thu, May 23, 2013 at 7:36 AM, Dr. Hawkins doch...@gmail.com wrote:
There is also a 1/3 chance that the same number is generated three
times (3*(1/3*1/3)).
Scratch that; not quite awake yet. That should be a 1/9 chance (3*
(1/3*1/3*1/3)).
This leaves 2/3 of the time in which at least one
On Thu, May 23, 2013 at 1:08 AM, Dar Scott d...@swcp.com wrote:
The problem is equality in the sort. It keeps the same order in
comparison of pairs of items. For example, the items sorted in the last
case above as though they were 2,2,3. The first item is still first.
So...
Use large
On 23.05.2013 at 9:51 Uhr -0500 Geoff Canyon apparently wrote:
To Dar's point, here the stable sort means that you should never use this
to get a random sort:
sort lines of someContainer by random(the number of lines of someContainer)
You are almost guaranteed to get less than random results.
Yikes! I was thinking the default was automatic and not text. Good idea!
Now, I wonder if it makes a difference in the final probabilities. Maybe
performance is influenced.
On May 23, 2013, at 10:37 AM, Robert Brenstein wrote:
On 23.05.2013 at 9:51 Uhr -0500 Geoff Canyon apparently
Thanks for pointing that out! I've got some checking to do of old code.
Imagine the weighting that would be caused by random(20)...
.Jerry
On May 23, 2013, at 9:37 AM, Robert Brenstein r...@robelko.com wrote:
I wonder why nobody suggests adding numeric parameter to random sorts like
above.
I disagree with Jerry here. Using random(20) for sorting would give a different
order with numeric vs. without, all else being equal, but it would still be
just as random. Just because most of the random(20) results start with the
character 1 doesn't mean they aren't unique or that they are
Note that the variable lineAssignments in the quoted code below is always empty
when it is displayed in the field and is empty each time the function randomLog
is entered. You can make lineAssignment global to both handlers and it will
work.
For a uniformly randomly shuffling function all
Because my test script said
sort this_item_list by random(something)
instead of
sort item this_item_list by random(something)
D'oh,
Michael
On May 24, 2013, at 9:47 AM, Michael Mays michael_livec...@nayyan.com wrote:
I really don't understand why when the random function is
15 matches
Mail list logo