Hoşgeldin Misafir

C# rastgele key üretme

Mutlu GÜNER

5 Eyl 2017
31 Mesaj

Aktiflik

Seviye

Deneyim

TIM / GÖREV:
PHP:
public string RastgeleKey()
        {
            Random rnd = new Random();
            string harfler = "ABCDEFGHIJKLMNOPRSTUVYZ";
            int a, s1, s2, s3, s4, s5;
            a = rnd.Next(0, 10);
            s1 = a + 5;
            s2 = a % 2 + a % 3;
            s3 = a + a % 2;
            s4 = a + a % 3;
            s5 = a % 3 + 3;
            string anahtar = harfler.Substring(s1, 1) + s2.ToString() + harfler.Substring(s3, 1) + s4.ToString() + harfler.Substring(s5, 1);
            return anahtar;
        }

        private v.o.i.d button1_Click(object sender, EventArgs e)
        {
            textBox1.Text = RastgeleKey();
        }