Hi all

I've got a teacher making games using Flash MX, and he asked me if I had
any code for generating an array with the numbers 1 thru 4 in a random
order. It's used to place Flash objects in random locations when the
student loads the game. As it turns out, I had exactly the code he needs,
but Flash Actionscript appears to be either C or C++. Is there a scripting
guru out there who can translate this for me?

<code>

#!c:/perl/bin

@array=(1,2,3,4);

$times=int(rand 49)+1;

while ($times<50){


                 $a=int(rand 3);

                 $b=$array[$a];

                 splice(@array, $a, 1);

                 unshift(@array,$b);

                 #print "$times\n";

                 $times++;
}

foreach $stuff (@array){
                        print $stuff;
                        print "\n";
}

</code>

-------------------------------------------------
Hamish McBrearty     MCSE  MCSA
Network Engineer
Rangi Ruru Girls' School
59 Hewitts Road
Christchurch
NEW ZEALAND
Ph 03 355-6099
Fax 03 355-6027
CELL 021 999770
E-Mail: [EMAIL PROTECTED]
--------------------------------------------------


Reply via email to