//method for random strign generation...
public static String RandomStringOfLength(int strLength)
{
StringBuilder builder = new StringBuilder();
Random random = new Random();
char ch;
for (int i = 0; i < strLength; i++)
{
System.Threading.Thread.Sleep(1);
ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65)));
builder.Append(ch);
}
return builder.ToString();
}
//method for random number generation...
public static String RandomNumberOfLength(int numLength)
{
StringBuilder builder = new StringBuilder();
Random random = new Random();
//char ch;
for (int i = 0; i < numLength; i++)
{
System.Threading.Thread.Sleep(1);
builder.Append(random.Next(0,9).ToString());
}
return builder.ToString();
}
Thursday, December 20, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment