Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  ae
Language: C/C++
Code:
public partial class Form1 : Form

    {

        public static string possibleChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

        public static char[] possibleCharsArray = Form1.possibleChars.ToCharArray();

        public static int possibleCharsAvailable = Form1.possibleChars.Length;

        public static Random random = new Random();

        public Form1()

        {

            InitializeComponent();

        }

 

        public string GenerateRandomString(int num)

        {

            byte[] buffer = new byte[num];

            Form1.random.NextBytes(buffer);

            char[] chArray = new char[num];

            while (num-- > 0)

                chArray[num] = Form1.possibleCharsArray[(int)buffer[num] % Form1.possibleCharsAvailable];

            return new string(chArray);

        }

 

        public string OgrenciKodOlustur(string str)

        {

            if (str.Length != 24)

                return "";

            string str1 = str.Substring(15, 4) + str.Substring(20, 4);

            string str2 = "PASS";

            string str3 = "";

            for (int index = 0; index < 8; ++index)

                str3 = this.addNum(str3);

            string str4 = str3 + this.GenerateRandomString(20);


          
Comments: