src/Util.php
public static function makeRandomString( $length, $char_set = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_' )
    {
        $ret = '';
        $char_set_cnt = strlen($char_set);

        mt_srand();
        for($i = 0; $i < $length; $i++){
            $idx = mt_rand(0, $char_set_cnt - 1);
            $ret .= $char_set[ $idx ];
        }

        return $ret;
    }
public static function makeRandomString( $length, $char_set = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_' )
    {
        $ret = '';
        $char_set_cnt = strlen($char_set);

        mt_srand();
        for($i = 0; $i < $length; $i++){
            $idx = mt_rand(0, $char_set_cnt - 1);
            $ret .= $char_set[ $idx ];
        }

        return $ret;
    }
public static function makeRandomString ( $ length , $ char_set = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_' ) { $ ret = '' ; $ char_set_cnt = strlen ( $ char_set ) ; mt_srand ( ) ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ idx = mt_rand ( 0 , $ char_set_cnt - 1 ) ; $ ret .= $ char_set [ $ idx ] ; } return $ ret ; }
make random string

@param int $length
@param string $char_set

@return string
make random string