随机生成26大写字母
class Create
{
static Int32 Temp = 1;//这里的Temp可以等于任意数
public static char RandomLetter()
{
Random R = new Random(DateTime.Now.Millisecond + Temp);//为了每次的种子都不同,Temp每次被赋予了不同的值
Int32 Num = R.Next(65, 91);
Temp = Num+Num;
return (char)Num;
}
//public static char RandomLetter()
//{
// Random R = new Random(DateTime.Now.Millisecond);
// Int32 Num = R.Next(65, 91);
// Thread.Sleep(1);
// return (char)Num;
//}
}
上面是两种不同的方法
{
static Int32 Temp = 1;//这里的Temp可以等于任意数
public static char RandomLetter()
{
Random R = new Random(DateTime.Now.Millisecond + Temp);//为了每次的种子都不同,Temp每次被赋予了不同的值
Int32 Num = R.Next(65, 91);
Temp = Num+Num;
return (char)Num;
}
//public static char RandomLetter()
//{
// Random R = new Random(DateTime.Now.Millisecond);
// Int32 Num = R.Next(65, 91);
// Thread.Sleep(1);
// return (char)Num;
//}
}