<static> getRandomItem(objects, startIndex, length) → {object}
Fetch a random entry from the given array.
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 selected.
- Source code: utils/ArrayUtils.js (Line 27)
Please login to continue.