note 89057 added to function.mt-rand

From: Date: Thu, 19 Feb 2009 17:13:51 +0000
Subject: note 89057 added to function.mt-rand
Groups: php.notes 
Request: Send a blank email to php-notes+get-150864@lists.php.net to get a copy of this message
just another example: both of these routines return a random decimal number between -1 and 1... since rand() only returns a max 'integer' value while mt_rand() return a max 'long' value -- at least on some platforms -- mt_rand() could be the better precision choice for some on any variation to this routine (but i don't think it matters here): <?php echo "-1 to 1 rand() value: ". (rand(getrandmax()*-1,getrandmax())/getrandmax()). "\n<br/>"; echo "-1 to 1 mt_rand() value: ". (mt_rand(mt_getrandmax()*-1,mt_getrandmax())/mt_getrandmax()). "\n"; ?> ---- Server IP: 69.147.83.197 Probable Submitter: 66.81.248.190 ---- Manual Page -- http://www.php.net/manual/en/function.mt-rand.php Edit -- https://master.php.net/note/edit/89057 Del: integrated -- https://master.php.net/note/delete/89057/integrated Del: useless -- https://master.php.net/note/delete/89057/useless Del: bad code -- https://master.php.net/note/delete/89057/bad+code Del: spam -- https://master.php.net/note/delete/89057/spam Del: non-english -- https://master.php.net/note/delete/89057/non-english Del: in docs -- https://master.php.net/note/delete/89057/in+docs Del: other reasons-- https://master.php.net/note/delete/89057 Reject -- https://master.php.net/note/reject/89057 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#150864) next »