I have a quick question. I have a keygen to generate random passwords for my application. It generates uppercase letters and numbers, but I want it to be like in some programs that format their code, like this xxxx-xxxx-xxxx . still my code is this
Random random = new Random(0); private void button1_Click(object sender, EventArgs e) { textBox1.Text = getrandomcode(); } public string getrandomcode() { char[] tokens = {'0', '1', '2', '3', '4', '5', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}; char[] codeArray = new char[24]; for (int i = 0; i < 24; i++) { int index = random.Next(tokens.Length - 1); codeArray[i] = tokens[index]; } return new String(codeArray); }
Something simple is not complicated, so I hope there is a way to implement a “-” for this code.
early!