📜  unity 创建随机字符串 - C# 代码示例

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

代码示例2
string RandomStringGenerator(int lenght)
    {
        //string st = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
        string result = "";
        for (int i = 0; i < lenght; i++)
        {
            char c = (char)('A' + Random.Range(0, 26));
            result += c;
        }

        return result;
    }