Branch: Tag:

1998-02-28

1998-02-28 18:13:03 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Added shuffle().

Rev: lib/modules/Array.pmod:1.16

59:    }   }    + array shuffle(array arr) + { +  int i = sizeof(arr);    -  +  while(i) { +  int j = random(i--); +  if (j != i) { +  mixed tmp = arr[i]; +  arr[i] = arr[j]; +  arr[j] = tmp; +  } +  } +  return(arr); + } +  +    int search_array(mixed *arr, mixed fun, mixed ... args)   {    int e;