zoukankan      html  css  js  c++  java
  • 随机集合

    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;
            }
        }
  • 相关阅读:
    web service 项目 和 普通 web项目 的 区别
    1) Apache Maven 's README.txt
    spring + rs + RocketMQ 【精】
    wadl 的自动生成(cxf版本3.1.1)
    新建maven web 项目后,出现的小问题
    cxf-rs client 调用
    wadl 的自动生成(cxf版本2.7.6)
    Java学习路线
    Tomcat 学习记录
    Spring Boot 学习记录
  • 原文地址:https://www.cnblogs.com/jeriffe/p/2277833.html
Copyright © 2011-2022 走看看