diff options
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 |