Below function generate random string.
private string RandomString(int size, bool lowerCase)
{
StringBuilder builder = new StringBuilder();
Random random = new Random();
char ch;
int val;
for (int i = 0; i < size; i++)
{
ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65)));
//val = random.Next(0, 9);
builder.Append(ch.ToString());
}
if (lowerCase)
return builder.ToString().ToLower();
return builder.ToString();
}
Wednesday, October 8, 2008
Generate Random String
at
12:03 AM
·
0
comments
Category: Other
Subscribe to:
Posts (Atom)
Archivo
Categories
- Custom Control (1)
- Data Control (1)
- Graphics GDI+ (11)
- Other (6)
- SQL SERVER (1)