/*** @author Richard Davey <rich@photonstorm.com>* @copyright 2020 Photon Storm Ltd.* @license {@link https://opensource.org/licenses/MIT|MIT License}*/var SpliceOne = require('./SpliceOne');/*** 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.** @function Phaser.Utils.Array.RemoveRandomElement* @since 3.0.0** @param {array} array - The array to removed a random element from.* @param {integer} [start=0] - The array index to start the search from.* @param {integer} [length=array.length] - Optional restriction on the number of elements to randomly select from.** @return {object} The random element that was removed, or `null` if there were no array elements that fell within the given range.*/var RemoveRandomElement = function (array, start, length){if (start === undefined) { start = 0; }if (length === undefined) { length = array.length; }var randomIndex = start + Math.floor(Math.random() * length);return SpliceOne(array, randomIndex);};module.exports = RemoveRandomElement;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。