C/C++随机生成32位字符串
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
void srand_str()
{
char m[64]={0},s[10]={0};
srand(time(0));
for(int i = 0; i<32; i++)
{
int x,type;
type = rand()%3;
if(type == 0)//判断随机类型生成大小写或者字母
{
x=rand()%('Z'-'A'+1)+'A';
}else if(type == 1){
x=rand()%('z'-'a'+1)+'a';
}else if(type ==2){
x=rand()%('9'-'0'+1)+'0';
}
sprintf(s,"%c",x);
strcat(m,s);
}
printf("%s\n",m);
}