日期:2014-05-17  浏览次数:21036 次

求8个 不重复的 随机数
List<int> list = new List<int>();
                bool end = true;
                int row = -1;
                while (end)
                {
                    bool b = true;
                    if (list.Count == 0)
                    {
                        row = new Random().Next(dealerList.Rows.Count);
                        list.Add(row);
                        continue;
                    }
                    row = new Random().Next(dealerList.Rows.Count);
                    for (int i = 0; i < list.Count; i++)
                    {
                        if (list[i] == row)
                        {
                            b = false;
                            break;
                        }