Random 生成不重复的随机数
Hashtable ha = new Hashtable();
Random rm = new Random();
for (int i = 0; ha.Count < 4; i++)
{
int number = rm.Next(1,10);
if (!ha.ContainsValue(number))
{
ha.Add(number, number);
Console.WriteLine(number.ToString());
}
}