llListRandomize

From Second Life Wiki
Revision as of 16:29, 31 January 2007 by Phoenix Linden (talk | contribs)
Jump to navigation Jump to search

Summary

Function: list llListRandomize( list src, integer stride );

Returns a list which is a randomized permutation of src.

• list src A list you want to randomize.
• integer stride How many list entries to keep next to each other during the randomization.

Specification

When you want to randomize the position of every list element, specify a stride of 1.

If the stride is not a factor of the list length, the src list is returned. In other words, src.length() % stride must be 0.

Conceptually, the algorithm selects src.lengh()/stride buckets, and then for each bucket swaps it the contents with another bucket.

Examples

list straws = ["long", "long", "long", "short"];
list shuffled = llListRandomize(straws, 1);
llSay(0, llList2CSV(bar));

Deep Notes

Search JIRA for related Issues

Signature

function list llListRandomize( list src, integer stride );