Added Random.pop()

This commit is contained in:
pyoor 2017-04-12 10:40:50 -04:00
parent 5dbe5b7fa6
commit 05ad767b05
1 changed files with 9 additions and 0 deletions

View File

@ -141,5 +141,14 @@ var random = {
result.push(this.pick(list));
}
return result;
},
pop: function (arr) {
// Removes and returns a random item from an array
var i, obj;
obj = Random.item(arr);
arr.splice(arr.indexOf(obj), 1);
return obj;
}
};