> yes like:
> 
> allNumbers:Array = [ 0, 1, 2, 3, ..., 100 ];
> tenNumbers:Array = [];
> 
> public function getNumberIn():void{
>         var n:int = tenNumbers.splice( int( Math.random * 10 ), 1 );
>         tenNumbers.push( allNumbers.splice( int( Math.random *
> allNumbers.length ), 1 ) );
>         allNumbers.push( n );
> }
> 
> Could be like that. ;)

Make a temporary copy of the allnumbers array then splice from the copy.

AS2: 
<code>

var allNumbers:Array = [0, 1, 2, 3, ..., 100];
var tenNumbers:Array = [38, 10, 70, 30, 63, 20, 66, 37, 16, 87];
function getNumberIn():Void{
        var ca:Array = [].concat(allNumbers);
        var n:Number = 10;
        while(n--){
                tenNumbers[n] = ca.splice(Math.floor(Math.random() *
ca.length - 1), 1);
        }
        trace("\ntenNumbers = "+tenNumbers);
}

</code>

Regards, 

-Keith 
http://keithreinfeld.home.comcast.net
 



_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to