MCPcopy
hub / github.com/phaserjs/phaser / RemoveRandomElement

Function RemoveRandomElement

src/utils/array/RemoveRandomElement.js:22–30  ·  view source on GitHub ↗
(array, start, length)

Source from the content-addressed store, hash-verified

20 * @return {object} The random element that was removed, or `null` if there were no array elements that fell within the given range.
21 */
22var RemoveRandomElement = function (array, start, length)
23{
24 if (start === undefined) { start = 0; }
25 if (length === undefined) { length = array.length; }
26
27 var randomIndex = start + Math.floor(Math.random() * length);
28
29 return SpliceOne(array, randomIndex);
30};
31
32module.exports = RemoveRandomElement;

Callers 1

Calls 1

SpliceOneFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…