diff options
author | Aaron Brashears <aaronb@lindenlab.com> | 2007-01-18 00:44:48 +0000 |
---|---|---|
committer | Aaron Brashears <aaronb@lindenlab.com> | 2007-01-18 00:44:48 +0000 |
commit | c189fc0b579352c34285fcf03db4b5bca5cd3804 (patch) | |
tree | ba32536c8bf3b23f311e7ae77aa69f9cbaec4582 /indra/lscript/lscript_alloc.h | |
parent | 73f0b5029aa247a563862fc39152ce58baa407aa (diff) |
Result of svn merge -r56700:56797 svn+ssh://svn/svn/linden/branches/more-random into release.
Diffstat (limited to 'indra/lscript/lscript_alloc.h')
-rw-r--r-- | indra/lscript/lscript_alloc.h | 70 |
1 files changed, 1 insertions, 69 deletions
diff --git a/indra/lscript/lscript_alloc.h b/indra/lscript/lscript_alloc.h index 485a65061a..2870364a9c 100644 --- a/indra/lscript/lscript_alloc.h +++ b/indra/lscript/lscript_alloc.h @@ -271,74 +271,6 @@ inline LLScriptLibData *lsa_bubble_sort(LLScriptLibData *src, S32 stride, S32 as } -inline LLScriptLibData *lsa_randomize(LLScriptLibData *src, S32 stride) -{ - S32 number = src->getListLength(); - - if (number <= 0) - { - return NULL; - } - - if (stride <= 0) - { - stride = 1; - } - - if (number % stride) - { - LLScriptLibData *retval = src->mListp; - src->mListp = NULL; - return retval; - } - - LLScriptLibData **sortarray = new LLScriptLibData*[number]; - - LLScriptLibData *temp = src->mListp; - S32 i = 0; - while (temp) - { - sortarray[i] = temp; - i++; - temp = temp->mListp; - } - - S32 k, j, s; - - for (k = 0; k < 20; k++) - { - for (i = 0; i < number; i += stride) - { - for (j = i; j < number; j += stride) - { - if (frand(1.f) > 0.5) - { - for (s = 0; s < stride; s++) - { - temp = sortarray[i + s]; - sortarray[i + s] = sortarray[j + s]; - sortarray[j + s] = temp; - } - } - } - } - } - - i = 1; - temp = sortarray[0]; - while (i < number) - { - temp->mListp = sortarray[i++]; - temp = temp->mListp; - } - temp->mListp = NULL; - - src->mListp = NULL; - - LLScriptLibData *ret_value = sortarray[0]; - delete [] sortarray; - - return ret_value; -} +LLScriptLibData* lsa_randomize(LLScriptLibData* src, S32 stride); #endif |