- Some deflexing of the low-level narya stuff. More to come, as we're

going to want the minimum client to be flex-free.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4507 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2007-01-22 19:58:24 +00:00
parent d10b94df85
commit e6c38e81c6
11 changed files with 206 additions and 95 deletions
+16
View File
@@ -20,6 +20,22 @@ public class ArrayUtil
});
}
/**
* Randomly shuffle the elements in the specified array.
*/
public static function shuffle (arr :Array) :void
{
// starting from the end of the list, repeatedly swap the element in
// question with a random element previous to it up to and including
// itself
for (var ii :int = arr.length - 1; ii > 0; ii--) {
var idx :int = int(Math.random() * (ii + 1));
var tmp :Object = arr[idx];
arr[idx] = arr[ii];
arr[ii] = tmp;
}
}
public static function indexOf (arr :Array, element :Object) :int
{
if (arr != null) {