in as3 you could just dish it up using a for each loop

On 8/13/07, Cedric Muller <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> There's that good old shuffleArray, don't know if that will be
> sufficient:
>
> function shuffleArray (arr_p:Array):Array {
>         var len:Number = arr_p.length, mixed:Array = arr_p.slice(),
> rn:Number, it:Number, el:Object;
>         for (it = 0; it<len; it++) {
>                 el = mixed[it];
>                 mixed[it] = mixed[rn = random(len)];
>                 mixed[rn] = el;
>         }
>         return mixed;
> }
>
> var myArr = new Array(40, 32, 90, 76, 66);
> var rdnArr = shuffleArray(myArr);
> //      or
> myArr = shuffleArray(myArr);
>
> hth,
> cedric
>
>
> > Hi
> >
> > I have one Array with random numbers [40,32,90,76,66]
> >
> > I need copy of this array but the order should be different and
> > random.
> > Something like this: [76,90,40,32,66]. How can this be done?
> > Thanks for any help.
> > _______________________________________________
> > [email protected]
> > 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
>
> _______________________________________________
> [email protected]
> 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
>



-- 
j:pn
http://www.memorphic.com/news/
_______________________________________________
[email protected]
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

Reply via email to