static void Main(string[] args)
{
String word = "abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < 11; i++)
{
int a= getphone(getphone(i-1));
Console.Write(word.Substring(a,1));
}
}
//create random
static int getphone(int seed)
{
Random rand = new Random(seed);
int a = rand.Next(0, 25);
return a;
}[@more@]static void Main(string[] args)
{
String word = "abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < 11; i++)
{
int a= getphone(getphone(i-1));
Console.Write(word.Substring(a,1));
}
}
//create random
static int getphone(int seed)
{
Random rand = new Random(seed);
int a = rand.Next(0, 25);
return a;
}
{
String word = "abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < 11; i++)
{
int a= getphone(getphone(i-1));
Console.Write(word.Substring(a,1));
}
}
//create random
static int getphone(int seed)
{
Random rand = new Random(seed);
int a = rand.Next(0, 25);
return a;
}[@more@]static void Main(string[] args)
{
String word = "abcdefghijklmnopqrstuvwxyz";
for (int i = 0; i < 11; i++)
{
int a= getphone(getphone(i-1));
Console.Write(word.Substring(a,1));
}
}
//create random
static int getphone(int seed)
{
Random rand = new Random(seed);
int a = rand.Next(0, 25);
return a;
}
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/310974/viewspace-998187/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/310974/viewspace-998187/
本文提供了一个使用C#语言生成随机字符序列的简单示例。通过双重调用随机数生成器,从预定义的字母字符串中选择字符并打印出来。此代码段展示了如何利用C#中的Random类来实现这一功能。
1241

被折叠的 条评论
为什么被折叠?



