📅  最后修改于: 2023-12-03 15:29:46.461000             🧑  作者: Mango
C# Word Randomizer is a small application that generates random words using C# programming language. It is a simple and efficient program that can be used for a variety of purposes such as generating unique passwords, creating fake names or email addresses, and more.
public static string RandomString(int length)
{
const string pool = "abcdefghijklmnopqrstuvwxyz0123456789";
var builder = new StringBuilder();
for (var i = 0; i < length; i++)
{
var c = pool[random.Next(0, pool.Length)];
builder.Append(c);
}
return builder.ToString();
}
// Generate 10 random words with length of 8 characters each
var words = Enumerable.Range(0, 10).Select(_ => RandomString(8));
foreach (var word in words)
{
Console.WriteLine(word);
}
C# Word Randomizer is a useful tool for generating random strings and can be easily integrated into your projects. The sample code provided should give you an idea of how to implement the program in your own code.