Andrew Barnett wrote:
Hey All,
I'm trying to work out how to randomise the order of a bunch of strings I
have. I know how to pick one random string from a bunch of them, but how do
I make sure that everyone is used just once.

$used_strings = array();
while (true) {
  $string = get_random_string();
  if (!isset($used_strings[$string])) {
    $used_strings = 1;
    break;
  }
}

--
Postgresql & php tutorials
http://www.designmagick.com/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to