static string guidList = @"D:GuidList.txt";
static string[] source =null;
static string getTheRandomYanZhengMa() {
string result = "";
string[] copySource = new List<string>(source).ToArray();
Random random = new Random();
for (int i = 0; i < 6; i++) {
int length = copySource.Length;
int index = random.Next(0, copySource.Length);
string temp=copySource[index];
result += temp;
copySource[index] = copySource[length - 1];
copySource[length - 1] = temp;
length--;
}
return result;
}
static void Main()
{
source = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "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" };
using(StreamWriter st=new StreamWriter(guidList))
{
//[] source = {"0","1","2","3","4","5","6","7","8","9","0","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"};
Dictionary<string, bool> datas = new Dictionary<string, bool>();
while (true)
{
if (datas.Count == 3000)
{
break;
}
else
{
string randomText = getTheRandomYanZhengMa();
if (!datas.ContainsKey(randomText))
{
datas.Add(randomText,true);
}
}
}
int j = 1;
foreach (string key in datas.Keys)
{
if (j == 3000)
{
st.Write((j) + " " + key);
}
else
{
st.Write((j ) + " " + key + "
");
}
j++;
}
}