コード例 #1
0
        public static string CreateAuthStr(int len, bool onlyNum)
        {
            if (!onlyNum)
            {
                return(TextUtility.CreateAuthStr(len));
            }
            StringBuilder stringBuilder = new StringBuilder();
            Random        random        = new Random();

            for (int i = 0; i < len; i++)
            {
                int num = random.Next();
                stringBuilder.Append((char)(48 + (ushort)(num % 10)));
            }
            return(stringBuilder.ToString());
        }