From 75838eb5bfbb39df83f8144666341223db6fa1fa Mon Sep 17 00:00:00 2001 From: Cleyton Date: Tue, 7 Jan 2014 09:57:04 -0200 Subject: [PATCH] Update GeraNumero.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mt_rand() é 4x mais rápido que rand(). --- include/GeraNumero.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/GeraNumero.php b/include/GeraNumero.php index 15637d2..24ca988 100644 --- a/include/GeraNumero.php +++ b/include/GeraNumero.php @@ -35,10 +35,10 @@ public function __construct() */ private function __gerarNumero() { - $numero = rand($this->min, $this->max); + $numero = mt_rand($this->min, $this->max); if ( !empty($this->numeros) && count($this->numeros) < $this->max ) { while(in_array($numero, $this->numeros)) { - $numero = rand($this->min, $this->max); + $numero = mt_rand($this->min, $this->max); } } else { if ( count($this->numeros) >= $this->max ) { @@ -52,4 +52,4 @@ private function __gerarNumero() } -new GeraNumero(); \ No newline at end of file +new GeraNumero();