note 45465 deleted from function.mt-rand by bjori

From: Date: Sun, 16 Apr 2006 12:31:41 +0000
Subject: note 45465 deleted from function.mt-rand by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-108259@lists.php.net to get a copy of this message
Note Submitter: Julien CROUZET jucrouzet_at_cpan.org ---- mt_rand is a better random method, BUT mt_rand() is NOT four time faster than rand() $> time echo "<?php \$i = 1000000; while(\$i--) { rand(0,10); } ?>" | php php 1.68s user 0.01s system 99% cpu 1.693 total $> time echo "<?php \$i = 1000000; while(\$i--) { mt_rand(0,10); } ?>" | php php 1.69s user 0.02s system 100% cpu 1.708 total time echo "<?php \$i = 1000000; while(\$i--) { rand(0,100000); } ?>" php 1.71s user 0.00s system 99% cpu 1.713 total time echo "<?php \$i = 1000000; while(\$i--) { mt_rand(0,100000); } ?>" | php php 1.72s user 0.02s system 100% cpu 1.726 total

« previous php.notes (#108259) next »