Re: Randomiser

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux