Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How can I generate random numbers (int) in C#.NET?

int Numbers
0
Posted

How can I generate random numbers (int) in C#.NET?

0

Answer hi here is my simple method generate random password for you can remove alphabet from this int num = random.Next(1000); does this here is another one more detail public static string GetRandomPassword(int numChars, int seed) { string[] chars = { “A”, “B”, “C”, “D”, “E”, “F”, “G”, “H”, “I”, “J”, “K”, “L”, “M”, “N”, “P”, “Q”, “R”, “S”, “T”, “U”, “V”, “W”, “X”, “Y”, “Z”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9” }; Random rnd = new Random(seed); string random = string.Empty; for (int i = 0; i < numChars; i++) { random += chars[rnd.Next(0, 33)]; } return random; } Happy Programming!!

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123