示例#1
0
        private void btnRandomize_Click(object sender, EventArgs e)
        {
            // https://stackoverflow.com/questions/273313/randomize-a-listt
            int n = results.Count;

            while (n > 1)
            {
                n--;
                int            k     = r.Next(n + 1);
                AcademicResult value = results[k];
                results[k] = results[n];
                results[n] = value;
            }

            ShowList();
        }
示例#2
0
        public void RandomizeResults()
        {
            // https://stackoverflow.com/questions/273313/randomize-a-listt
            Random r = new Random();

            int n = results.Count;

            while (n > 1)
            {
                n--;
                int            k     = r.Next(n + 1);
                AcademicResult value = results[k];
                results[k] = results[n];
                results[n] = value;
            }
        }