http://www.actionscript.org/forums/showthread.php3?s=&threadid=28769
Quick question. Whats the fastest way to get 5 random numbers out of a
list
of X number of numbers without having any duplicates?
Kinda like the script below excpet it graps duplicates...
var loopNum:Number = 16;
function getRandomNums(){
for(i=0; i<5; i++){
lastNum = newNum;
while(newNum == lastNum){
newNum = random(loopNum);
}
questionOrder[i] = newNum;
}
trace(questionOrder); // 0,1,3,2,3 "how do I get no duplicates?"
}
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com