笨小孩做开发

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

            int [] intarry = new int [100];
            ArrayList myList = new ArrayList();
            Random rd = new Random();
            for (int i = 0; i < 100; i ++ )
            {
               // myList.Add(rd.Next(1,101));
                int num = rd.Next(1,101);
                if(!myList.Contains(num))
                {
                    myList.Add(num);
                }
               
            }

            for (int k = 0; k < myList.Count; k++ )
            {
                intarry[k] =(int) myList[k];
                Console.WriteLine(intarry[k]);
            }
            Console.Read();

posted on 2013-04-01 09:50  笨小孩做开发  阅读(184)  评论(0编辑  收藏  举报