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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Krishna GaradRank #191 · 12.8K reputationPosted Feb 3, 2011, 11:07 PM EST
Erdinc Kolukisa109 reputationPosted Feb 3, 2011, 11:36 PM EST
ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65)));
what is 26 and 65 ?
Krishna GaradRank #191 · 12.8K reputationPosted Feb 3, 2011, 11:46 PM EST
ShinurajRank #696 · 3.5K reputationPosted Feb 3, 2011, 11:56 PM EST
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