note 62535 added to function.srand
| From: | nino at clan-csc dot com | Date: | Thu, 02 Mar 2006 16:56:11 +0000 |
| Subject: | note 62535 added to function.srand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-104723@lists.php.net to get a copy of this message | ||
I personally think that srand() doesn't make a lot of sense...
Why is this not good as srand() (used rand() )
<?
die();
//random message
$line = array(); // catch stuff
$line[] = "Message one";
$line[] = "Message two";
$line[] = "Message three";
$line[] = "Message four";
$line[] = "Message five";
$line[] = "Message six";
$num = count($line) - 1;
$random = rand(0,$num); // <<<< you see??
$oneliner = $line[$random]; //this is the thing to be echoed
echo "<p>$oneliner</p>";
/*
CSC 2006
Led by Nino, written by Nino
http://www.clan-csc.com
*/
?>
----
Server IP: 161.53.30.180
Probable Submitter: 193.198.149.193
----
X-Spam-Status: No, hits=3.3 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER,
HTML_MESSAGE autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.srand.php
Edit -- http://master.php.net/note/edit/62535
Del: integrated -- http://master.php.net/note/delete/62535/integrated
Del: useless -- http://master.php.net/note/delete/62535/useless
Del: bad code -- http://master.php.net/note/delete/62535/bad+code
Del: spam -- http://master.php.net/note/delete/62535/spam
Del: non-english -- http://master.php.net/note/delete/62535/non-english
Del: in docs -- http://master.php.net/note/delete/62535/in+docs
Del: other reasons-- http://master.php.net/note/delete/62535
Reject -- http://master.php.net/note/reject/62535
Search -- http://master.php.net/manage/user-notes.php