Csharp Random Name Picker Code Example


Example: generate random name c#


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)];
}

}

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable