<static> removeRandomItem(objects, startIndex, length) → {object}
Removes a random object from the given array and returns it.
Will return null if there are no array items that fall within the specified range
or if there is no item for the randomly chosen index.
Parameters
Name | Type | Description |
---|---|---|
objects | Array.<any> | An array of objects. |
startIndex | integer | Optional offset off the front of the array. Default value is 0, or the beginning of the array. |
length | integer | Optional restriction on the number of values you want to randomly select from. |
Returns
object -
The random object that was removed.
- Source code: utils/ArrayUtils.js (Line 51)
Please login to continue.