lr中生产随机数的高效新方法 ----转自云层blog
char *randstring1(int slen)
{
int i,randid;
char temp[100]="";
char character_set[52] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N','O', 'P','Q', 'R', 'S', 'T','U', 'V', 'W', 'X','Y', 'Z','a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l','m', 'n', 'o', 'p', 'q', 'r','s', 't', 'u', 'v', 'w', 'x','y','z'};
for(i=1;i<=slen;i++)
{ randid=rand()%52;
sprintf(temp,"%s%c",temp,character_set[randid]);
}
return(temp);
}
Action()
{
lr_output_message(randstring1(6));
return 0;
}
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) | Powered by Discuz! X3.2 |