Branch: Tag:

2002-08-26

2002-08-26 05:26:12 by Martin Nilsson <mani@lysator.liu.se>

Backing out Array.random. It's possible to use random directly.

Rev: lib/modules/Array.pmod:1.72

66:    int i = sizeof(arr);       while(i) { -  int j = predef::random(i--); +  int j = random(i--);    if (j != i) {    mixed tmp = arr[i];    arr[i] = arr[j];
692:    }    return sizeof(filter(haystack, `==, needle));   } -  - //! Returns a random element from the @[in] array. - mixed random(array in) { -  return in[predef::random(sizeof(in))]; - } +