📅  最后修改于: 2022-03-11 14:49:21.234000             🧑  作者: Mango
public Random a = new Random(); // replace from new Random(DateTime.Now.Ticks.GetHashCode());
// Since similar code is done in default constructor internally
public List randomList = new List();
int MyNumber = 0;
private void NewNumber()
{
MyNumber = a.Next(0, 10);
while(randomList.Contains(MyNumber))
MyNumber = a.Next(0, 10);
}