Thanks to all the suggestions re my random list problem. Particular thanks to 
Gerry Beauregard for this suggestion:

"It's probably best just to create an Array or Vector containing numbers 1 to 
40.  (Vectors are only available in AS3, not sure about Array).  Shuffle the 
array, then choose the first 10 elements......"

The following method of shuffling an array works fine in AS2:

var numArray:Array = new Array();
numArray = 
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40];
shuffle(numArray);

function shuffle(arr:Array) {
     var i:Number;
     for (i in arr) {
           var tmp = arr[i];
           var rNr:Number = Math.floor(Math.random()*arr.length);
           arr[i] = arr[rNr];
           arr[rNr] = tmp;
     }
}


This message is for the named person’s use only. It may contain
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or; lost by any mistransmission. If
you receive this message in error, please immediately delete it and all
copies of it from your system, destroy any hard copies of it and notify
the sender. You must not directly or indirectly, use, disclose,
distribute, print or copy any part of this message if you are not the
intended recipient. GOULBURN OVENS INSTITUTE OF TAFE and
any of its subsidiaries each reserve the right to monitor all e-mail
communications through its networks. Any views expressed in this
message are those of the individual sender, except where the
message states otherwise and the sender is authorised to state them
to be the views of any such entity.

#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared 
by MailMarshal
#####################################################################################
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to