src/php/Webforge/Common/StringUtil.php
public static function random($length) {
    if ($length <= 0) return '';
    $str = '';
    for ($i = 0; $i < $length; $i++) {
      $rand = rand(0, 35);
      if ($rand >= 10)
        $str .= chr(ord('a') + $rand-10); // a - z
      else
        $str .= chr(ord('0') + $rand);    // 0 - 9
    }
    
    return $str;
  }
public static function random($length) {
    if ($length <= 0) return '';
    $str = '';
    for ($i = 0; $i < $length; $i++) {
      $rand = rand(0, 35);
      if ($rand >= 10)
        $str .= chr(ord('a') + $rand-10); // a - z
      else
        $str .= chr(ord('0') + $rand);    // 0 - 9
    }
    
    return $str;
  }
public static function random ( $ length ) { if ( $ length <= 0 ) return '' ; $ str = '' ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ rand = rand ( 0 , 35 ) ; if ( $ rand >= 10 ) $ str .= chr ( ord ( 'a' ) + $ rand - 10 ) ; // a - z else $ str .= chr ( ord ( '0' ) + $ rand ) ; // 0 - 9 } return $ str ; }
Generates a Random string from specific length

the range of chars [a-z0-9] is used
@return string
Generates a Random string from specific length