Don't click here unless you want to be banned.

LSL Wiki : llListRandomize

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawling22.us.archive.org
list llListRandomize(list src, integer stride)

Returns src randomized into blocks of size stride.

If stride is less then one it is treated as 1.



Example:
// This shuffles each list item around.
list foo = ["LSL", "is", "teh", "sucks"];
list bar = llListRandomize(foo, 1);
llSay(0, llList2CSV(bar));
// This might make the object say "is, LSL, sucks, teh" or "LSL, sucks, 
// teh, is" or any of the other 22 combinations of possible lists.

// This breaks the list up into two blocks and moves them around.
list foo = ["LSL", "is", "teh", "sucks"];
list bar = llListRandomize(foo, 2);
llSay(0, llList2CSV(bar));
// This might make the object say "LSL, is, teh, sucks" or "teh, sucks, LSL, is",
// but nothing else would be possible.

// This does nothing.
list foo = ["LSL", "is", "teh", "sucks"];
list bar = llListRandomize(foo, 4);
llSay(0, llList2CSV(bar));
// Object says "LSL, is, teh, sucks"

For most purposes, setting stride to 1 is probably what you want. This will just randomize all the items in the list.

Compare with llListSort.


Lists | Functions
Comments [Hide comments/form]
Xylor ran a statistical analysis and determined that llListRandomize() isn't very random. He suggested running it 7 times.
-- HunsValen (2004-05-12 04:36:32)
What kind of statistical analysis did Xylor run? What were the specific results? I think that is exactly the kind of information that should be in this wiki.
-- AmaOmega (2004-05-13 00:30:24)
Yeah, I noticed that too in my use of llListRandomize... I have always run it 5 times to really mix it up.
-- AaronLevy (2004-07-31 03:26:38)
Since 1.6 it appears not to be random for strided lists any more... I have a script that used both and was get the non strided ones behaving properly, the strided ones were always showing the same first element.
-- EloisePasteur (2005-04-02 11:18:55)
Eloise: report that as a bug
-- BlindWanderer (2005-04-04 14:50:48)
Reported a bug today: llListRandomize does not produce a randomized list.

Expected Results: After randomizing each value should have an equal chance of being anywhere in the list.

Observed Results from 10,000 samples of a randomized list of 80 symbols:
a) Values near the beginning of the original list were four times more likely to be near the beginning of the randomized list.
b) Values near the end of the original list were four times more likely to be at the end of the randomized list.

This implies a shuffled a deck of cards ordered clubs, diamonds, hearts, spades, would be four times more likely to deal clubs first than spades.

STEPS TO REPRODUCE
- Initialize a list with elements from 1 to 80.
- Call llListRandomize, saving the output to a second list.
- Using llOwnerSay send the randomized list to the chat window.
- Copy the contents of the chat window to an external program.
- Count occurrences of each value in each position.
-- SheetSpotter (2006-12-14 18:54:26)
I have reviewed the source for llListRandomize and you are infact correct, the distribution is wrong. I have submitted a bug report and a patch that will fix the uneven distribution.

https://jira.secondlife.com/browse/SVC-4
-- BlindWanderer (2007-01-10 03:12:26)
They have know changed how this function works. It's kinda scary.
-- BlindWanderer (2007-01-18 13:27:17)
Hello!!!
<a href= http:www.spbgu.ru/blog34606 >female domination</a> [url= http:www.spbgu.ru/blog34606 ]female domination[/url]<a href= http:www.spbgu.ru/blog34603 >domination submission</a> [url= http:www.spbgu.ru/blog34603 ]domination submission[/url]<a href= http:www.spbgu.ru/blog34609 >fetish foot</a> [url= http:www.spbgu.ru/blog34609 ]fetish foot[/url]<a href= http:www.spbgu.ru/blog34610 >my friends hot mom</a> [url= http:www.spbgu.ru/blog34610 ]my friends hot mom[/url]
-- proxy.awanti.com (2007-06-11 18:27:58)
Attach a comment to this page: