Saturday, February 2, 2008

Random Number Generation

int count = 0;
int zero = Convert.ToInt16('0');
int nine = Convert.ToInt16('9');
int A = Convert.ToInt16('A');
int Z = Convert.ToInt16('Z');
//int a = Convert.ToInt16("a");
//int z = Convert.ToInt16("b");
Random ran = new Random();
while (count < random =" ran.Next(zero,">= zero) && (random <= nine)) || ((random >= A) && (random <= Z)))
{
str_no = str_no + Convert.ToChar(random);
count++;
}
}
randomnumber = str_no.ToString();

No comments: