LSL Wiki Mirror 7-7-7 : llListRandomize

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings ::
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
There are 9 comments on this page. [Display comments/form]