static char char_flag;// 1111 ,figure ,lowercase ,uppercase,special charstd::string generateString(){ std::string result = ""; srand((unsigned)time(NULL)); char_flag = 0; for(int i=0; i<8; i++){ char c = rand()%(127-33)+33; if(c >=48 &&c <= 57){ char_flag = char_flag|8; }else if(c >= 65 && c <= 90){ char_flag = char_flag|2; }else if(c >= 97 && c <= 122){ char_flag = char_flag|4; }else{ char_flag = char_flag|1; } result += c; } if(char_flag == 0xf) return result; if(char_flag %2 == 0){ char c = rand()%(127-33)+33; while((c>=48&& c<= 57 )|| (c>=65&&c<=90)||(c>=97&&c<=122)){ c = rand()%(127-33)+33; } result += c; } if((char_flag>>1 )%2 == 0){ char c = rand()%(91-65)+65; result += c; } if((char_flag>>2) %2 == 0){ char c = rand()%(127-97)+97; result += c; } if((char_flag>>3 )%2 == 0){ char c = rand()%(58-48)+48; result += c; } result+="\0"; SVP_INFO("------size = %d ----rand() = %s",result.size(),result.c_str()); return result;}