RE: [Flashcoders] getting 5 random numbers out of 0-16 no dups

2006-12-01 Thread Merrill, Jason
Quick question. Whats the fastest way to get 5 random numbers out of a list of X number of numbers without having any duplicates? I like this: function rndNumArray(max:Number, noZero:Boolean):Array{ var a:Array = new Array(); var n:Array = new

[Flashcoders] getting 5 random numbers out of 0-16 no dups

2006-11-30 Thread Corban Baxter
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; i5; i++){ lastNum = newNum;

Re: [Flashcoders] getting 5 random numbers out of 0-16 no dups

2006-11-30 Thread Andy Johnston
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

Re: [Flashcoders] getting 5 random numbers out of 0-16 no dups

2006-11-30 Thread Odie Bracy
This works for me: for(i=0; i5; i++){ seq[i]=99; do{ mflg=0; x=Math.floor(Math.random()*16); for(j=0; j=i; j++){ if(x==seq[j]) mflg=1; } } while(mflg==1);

Re: [Flashcoders] getting 5 random numbers out of 0-16 no dups

2006-11-30 Thread Corban Baxter
thanks guys. I appreciate it. On 11/30/06, Odie Bracy [EMAIL PROTECTED] wrote: This works for me: for(i=0; i5; i++){ seq[i]=99; do{ mflg=0; x=Math.floor(Math.random()*16); for(j=0; j=i; j++){