code: public static function rand($length = 10, $special = false)
  	{
  	    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  		$special && ($characters .= '!@#$%^&*()+=>:;*-~`{}[],');
  	    $charactersLength = strlen($characters);
  	    $randomString = '';
  	    for ($i = 0; $i < $length; $i++) {
  	        $randomString .= $characters[rand(0, $charactersLength - 1)];
  	    }
  	    return $randomString;
  	}
docs: Generate a random string with a certain length
  
  @param   integer $length
  @param   bool    $special
  @return  string