note 79141 added to function.mt-rand

From: Date: Tue, 13 Nov 2007 14:42:35 +0000
Subject: note 79141 added to function.mt-rand
Groups: php.notes 
Request: Send a blank email to php-notes+get-132226@lists.php.net to get a copy of this message
performance: for a repetitive task, it's much faster not to use the limit parameters, as shown below. just use the % operator. $t=microtime(true); for($i=0;$i<1000000;$i++) mt_rand()%3; echo microtime(true)-$t; echo '|'; $t=microtime(true); for($i=0;$i<1000000;$i++) mt_rand(0,2); echo microtime(true)-$t; echo '|'; $t=microtime(true); for($i=0;$i<1000000;$i++) mt_rand(); echo microtime(true)-$t; output: 0.316797971725|0.442242145538|0.253082036972 ---- Server IP: 194.153.94.10 Probable Submitter: 130.60.155.213 ---- Manual Page -- http://www.php.net/manual/en/function.mt-rand.php Edit -- https://master.php.net/note/edit/79141 Del: integrated -- https://master.php.net/note/delete/79141/integrated Del: useless -- https://master.php.net/note/delete/79141/useless Del: bad code -- https://master.php.net/note/delete/79141/bad+code Del: spam -- https://master.php.net/note/delete/79141/spam Del: non-english -- https://master.php.net/note/delete/79141/non-english Del: in docs -- https://master.php.net/note/delete/79141/in+docs Del: other reasons-- https://master.php.net/note/delete/79141 Reject -- https://master.php.net/note/reject/79141 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#132226) next »