Added Random.pop()
This commit is contained in:
parent
5dbe5b7fa6
commit
05ad767b05
1 changed files with 9 additions and 0 deletions
|
@ -141,5 +141,14 @@ var random = {
|
||||||
result.push(this.pick(list));
|
result.push(this.pick(list));
|
||||||
}
|
}
|
||||||
return result;
|
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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue