Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# generate random string

public static string CreateRandomString(int size)
{
    StringBuilder builder = new StringBuilder();
    Random random = new Random();

    char c;
    for(int i=0; i < size; i++)
    {
      c = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65)));
      builder.Append(c);
    }

    return builder.ToString();
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #generate #random #string
ADD COMMENT
Topic
Name
7+3 =