Generating Random string

Bageshkumarbagi
Posted by Bageshkumarbagi under C# category on | Points: 40 | Views : 593
private void button1_Click(object sender, EventArgs e)
{
var builder = new StringBuilder();
var random = new Random();

for (int i = 0; i < 10; i++)
{
builder.Append(Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))));
}
MessageBox.Show(builder.ToString());

}

Comments or Responses

Posted by: t5j9033387989 on: 11/29/2013 Level:Starter | Status: [Member] | Points: 10
Nice and very helpful code,

Thanks you.

Login to post response