📜  生成随机名称 c# 代码示例

📅  最后修改于: 2022-03-11 14:48:39.611000             🧑  作者: Mango

代码示例1
private void RandName()
  {
        string[] maleNames = new string[1000] { "aaron", "abdul", "abe", "abel", "abraham", "adam", "adan", "adolfo", "adolph", "adrian"};
        string[] femaleNames = new string[1000] { "abby", "abigail", "adele", "adrian"};
        string[] lastNames = new string[1000] { "abbott", "acosta", "adams", "adkins", "aguilar"};

        Random rand = new Random(DateTime.Now.Second);
        if (rand.Next(1, 2) == 1)
        {
            FirstName = maleNames[rand.Next(0, maleNames.Length - 1)];
        }
        else
        {
            FirstName = femaleNames[rand.Next(0, femaleNames.Length - 1)];
        }

  }