public static function getWeightedIndex(weights:Array, randomFn:Function = null):int
Return the picked index from a weighted list.
Parameters
| weights:Array — an Array containing Numbers, ints, or uints. All values should be
non-negative.
|
|
| randomFn:Function (default = null ) — random function that returns (0 <= value < 1), if null then Math.random() will
be used.
|
Returns
public static function pickRandom(values:Array, randomFn:Function = null):Object
Picks a random object from the supplied array of values. Even weight is given to all
elements of the array.
Parameters
| values:Array |
|
| randomFn:Function (default = null )
|
Returns
| Object — a randomly selected item or null if the array is null or of length zero.
|