Unique random # func - Flash
Unique random # func - Flash
Out of context: Reply #1
- Started
- Last post
- 1 Response
- SmilingBuddh0
Here's an Array prototype that will return a random index from the array (and delete that index):
Array.prototype.spitRandom = function() {
var i =random(this.length)
var spit = this[i];
this.splice(i,1);
return(spit);
}In your example, you can then use
var answer = quesArray.spitRandom();
to give you a random value.
Cheers.