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; }