RE: [PHP] Choosing a random value out of two
| From: | Taylor, Stewart | Date: | Fri, 04 May 2001 09:54:57 +0000 |
| Subject: | RE: [PHP] Choosing a random value out of two | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-51389@lists.php.net to get a copy of this message | ||
srand((double) microtime() * 1000000);
$which = rand(0,1);
$variable = ($which)? $value1 : $ value2;
-Stewart
-----Original Message-----
From: Sebastian Sprenger [mailto:creation@sprenger.cc]
Sent: 04 May 2001 10:21
To: php-general@lists.php.net
Subject: [PHP] Choosing a random value out of two
hi. i want to randomly assign either "value1" or "value2" to a $variable.
how can that be done?
thanks,
Sebastian
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net