Binarysharp.MemoryManagement.Helpers.Randomizer.GenerateString C# (CSharp) Метод

GenerateString() публичный статический Метод

Returns a random string where its size is within a specified range.
public static GenerateString ( int minSize = 40, int maxSize = 40 ) : string
minSize int The inclusive lower bound of the size of the string returned.
maxSize int The exclusive upper bound of the size of the string returned.
Результат string
        public static string GenerateString(int minSize = 40, int maxSize = 40)
        {
            // Create the string builder with a specific capacity
            var builder = new StringBuilder(GenerateNumber(minSize, maxSize));

            // Fill the string builder
            for (var i = 0; i < builder.Capacity; i++)
            {
                builder.Append(AllowedChars[GenerateNumber(AllowedChars.Length - 1)]);
            }

            return builder.ToString();
        }