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());
}
}
时间: 2024-10-12 07:56:11