62,074
社区成员
发帖
与我相关
我的任务
分享
string strTemp = "";
int times = 0;
Random ran = new Random();
for (int i = 0; ; i++)
{
int j = ran.Next(0, 6);//因为数组长度是7,所以这里范围就用0到6
if (!strTemp.Contains(str[j]))
{
strTemp += str[j] + ",";
times++;
if (times == 4)
{
break;
}
}
}
return strTemp;