📜  在 c# 代码示例中制作随机字母表

📅  最后修改于: 2022-03-11 14:48:40.786000             🧑  作者: Mango

代码示例1
private static Random random = new Random();
public static string RandomString(int length)
{
    const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    return new string(Enumerable.Repeat(chars, length)
      .Select(s => s[random.Next(s.Length)]).ToArray());
}