Created
May 5, 2016 16:26
-
-
Save abierhaus/14730be18a8aa771e050e41dde1da201 to your computer and use it in GitHub Desktop.
C# Generator that creates a random Word + Number combination from a dictionary
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
/// <summary> | |
/// Class RandomWordGenerator. | |
/// </summary> | |
public static class RandomWordGenerator | |
{ | |
/// <summary> | |
/// Creates the random word number combination. | |
/// </summary> | |
/// <returns>System.String.</returns> | |
public static string CreateRandomWordNumberCombination() | |
{ | |
Random rnd = new Random(); | |
//Dictionary of strings | |
string[] words = { "Bold", "Think", "Friend", "Pony", "Fall", "Easy" }; | |
//Random number from - to | |
int randomNumber = rnd.Next(2000, 3000); | |
//Create combination of word + number | |
string randomString = $"{words[rnd.Next(0, words.Length)]}{randomNumber}"; | |
return randomString; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment