random 6 digit number c#
Random generator = new Random();
String r = generator.Next(0, 1000000).ToString("D6");
random 6 digit number c#
Random generator = new Random();
String r = generator.Next(0, 1000000).ToString("D6");
random character c#
//Random Uppercase letter:
Random rnd = new Random();
int ascii_index = rnd.Next(65, 91); //ASCII character codes 65-90
char myRandomUpperCase = Convert.ToChar(ascii_index); //produces any char A-Z
//random lowercase letter:
Random rnd2 = new Random();
int ascii_index2 = rnd2.Next(97, 123); //ASCII character codes 97-123
char myRandomLowerCase = Convert.ToChar(ascii_index2); //produces any char a-z
//Random letter irrespective of case: (search up "random number from 2 different ranges" for explanation)
int i = rnd.Next(1, 3) == 1 ? rnd.Next(65, 91) : rnd.Next(97, 123);
char anyLetter = Convert.ToChar(i);
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us