I would like to allow users to choose the exact length, or less than / more than count o characters to be generated (in a password generator).
For example i have done:
// the longivity of the generated string
var stringChars = new char[int.Parse(TextBox2.Text)];
var random = new Random();
for (int i = 0; i < stringChars.Length; i++)
{
// abc has been declared before, it is simply ABCD... for character generation
stringChars[i] = abc[random.Next(abc.Length)];
}
var finalString = new String(stringChars);
// this is the result box
TextBox1.Text = finalString;
Now my problem is if user enters for eg. 10 and wants less than 10 characters of generated string, what should I do?