From 0b38159c94e0ab10fb1fa13482a70596d3298ea1 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 23 Apr 2010 18:41:01 +0000 Subject: [PATCH] "using mt_rand() instead of rand() and not longer seeding it explicitly (as recommened on php.net)" --- phpgwapi/inc/class.common.inc.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/phpgwapi/inc/class.common.inc.php b/phpgwapi/inc/class.common.inc.php index ba6e6b427b..fbddda46b1 100644 --- a/phpgwapi/inc/class.common.inc.php +++ b/phpgwapi/inc/class.common.inc.php @@ -281,18 +281,17 @@ class common */ static function randomstring($size) { - $s = ''; - srand((double)microtime()*1000000); - $random_char = array( + static $random_char = array( '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f', 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v', 'w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L', 'M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' ); - for ($i=0; $i<$size; $i++) + $s = ''; + for ($i=0; $i < $size; $i++) { - $s .= $random_char[rand(1,61)]; + $s .= $random_char[mt_rand(0,count($random_char)-1)]; } return $s; }