|
发表于 2020-6-5 23:15:01
|
显示全部楼层
最笨的方法
Random ran16=new Random();
string strTmp;
string str16 = "01 ";//初始化固定2位的数据,如01
while(str16.Length < (64 + 4))//四个空格位
{
strTmp = ran16.Next(0,15).ToString();
switch(strTmp)
{
case "10":
str16 += "A";
break;
case "11":
str16 += "B";
break;
case "12":
str16 += "C";
break;
case "13":
str16 += "D";
break;
case "14":
str16 += "E";
break;
case "15":
str16 += "F";
break;
default:
str16 += strTmp;
break;
}
switch(str16.Length)
{
case 6:
str16 += " ";
break;
case 21:
str16 += " ";
break;
case 42:
str16 += " ";
break;
default:
break;
}
} |
|