Skip to content

Instantly share code, notes, and snippets.

@JamesC01
Created September 22, 2017 22:56
Show Gist options
  • Save JamesC01/7fd4ede080df3a4c42c4346b221bd107 to your computer and use it in GitHub Desktop.
Save JamesC01/7fd4ede080df3a4c42c4346b221bd107 to your computer and use it in GitHub Desktop.
Random username generator
static void Main(string[] args)
{
string username = ChooseRandomAdjective() + ChooseRandomNoun();
Console.WriteLine(username); username = ChooseRandomAdjective() + ChooseRandomNoun();
Console.WriteLine(username); username = ChooseRandomAdjective() + ChooseRandomNoun();
Console.WriteLine(username); username = ChooseRandomAdjective() + ChooseRandomNoun();
Console.WriteLine(username); username = ChooseRandomAdjective() + ChooseRandomNoun();
Console.WriteLine(username); username = ChooseRandomAdjective() + ChooseRandomNoun();
Console.WriteLine(username);
Console.ReadLine();
}
static string ChooseRandomAdjective()
{
Random randomAdjective = new Random();
int num = randomAdjective.Next(1, 11);
string a = "";
switch (num)
{
case 1:
a = "Sweet";
break;
case 2:
a = "Cubic";
break;
case 3:
a = "Big";
break;
case 4:
a = "Rainy";
break;
case 5:
a = "Cold";
break;
case 6:
a = "Dark";
break;
case 7:
a = "Black";
break;
case 8:
a = "Long";
break;
case 9:
a = "Electric";
break;
case 10:
a = "Short";
break;
default:
a = "Error";
break;
}
return a;
}
static string ChooseRandomNoun()
{
Random randomNoun = new Random();
int num = randomNoun.Next(1, 11);
string n = "";
switch (num)
{
case 1:
n = "Dog";
break;
case 2:
n = "Tree";
break;
case 3:
n = "Doctor";
break;
case 4:
n = "Truth";
break;
case 5:
n = "Happiness";
break;
case 6:
n = "Neighbor";
break;
case 7:
n = "Instrument";
break;
case 8:
n = "Phone";
break;
case 9:
n = "Piano";
break;
case 10:
n = "Rain";
break;
default:
n = "Error";
break;
}
return n;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment