random numbers with letters
hi guys..i want to generate random number with letters..something like that 78asd231 i can generate random numbers but without letters..i dont know how to add them letters..i need help at that point..
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
ShinurajPosted Feb 4, 2011, 4:56 AM
Here is one c3 code that i got from c-sharpcorner!!
///
///
/// Size of the string
/// If true, generate lowercase string
///
private string RandomString(int size, bool lowerCase)
{
StringBuilder builder = new StringBuilder();
Random random = new Random();
char ch ;
for(int i=0; i
ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ;
builder.Append(ch);
}
return builder.ToString().ToLower();
return builder.ToString();
}
-shinu
Krishna GaradPosted Feb 4, 2011, 4:46 AM
Erdinc KolukisaPosted Feb 4, 2011, 4:36 AM
ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65)));
what is 26 and 65 ?
Krishna GaradPosted Feb 4, 2011, 4:07 AM