Created
September 22, 2017 22:56
-
-
Save JamesC01/7fd4ede080df3a4c42c4346b221bd107 to your computer and use it in GitHub Desktop.
Random username generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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