class Program
    {
        static  Random r = new Random(0);
        static void Main(string[] args)
        {
            List<string> list = new List<string> { "0""1""2""3""4""5""6""7""8""9" };
            List<string> result;
            int count = 0;
            while (count++ < 20)
            {
                Console.WriteLine("第{0}次轮询", count);
                list = new List<string> { "0""1""2""3""4""5""6""7""8""9" };
                result = RadomList(list);
                foreach (var item in result)
                {
                    Console.Write(item+" ");
                }
                Console.WriteLine();
            }
            Console.Read();
        }

        private static List<string> RadomList(List<string> list)
        {
            List<string> result = new List<string>();
         
            while (list.Count > 0)
            {
                int data = r.Next(0, list.Count);
                result.Add(list[data]);
                list.RemoveAt(data);
            }
            // result.Add(list[0]);
            return result;
        }
    }

相关文章:

  • 2022-01-20
  • 2021-06-13
  • 2021-08-10
  • 2022-01-07
  • 2021-08-02
  • 2021-10-09
  • 2021-09-20
  • 2021-12-30
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-02
  • 2021-06-07
  • 2022-01-22
  • 2022-12-23
相关资源
相似解决方案