Thread: Sorting array
View Single Post
  #8  
Old 02-06-2007, 04:48 AM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by Inverness View Post
That should be the simplest version.
PHP Code:
function onCreated() {
  
this.firstarray={"A","B","C",...,"Z"};
  
temp.len this.firstarray.size();
  
temp.take 2/* how many to take from first array */
  
this.secondarray this.firstarray;
  for (
temp.i=0;temp.i<temp.len-temp.take;temp.i++){
    
temp.random int(random(0,temp.len-temp.i-.0000001));
    
this.secondarray.delete(temp.random);
  }

__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote