• C#生成不重复随机数列表


    C#生成不重复(随机数 http://www.jbxue.com/tags/suijishu.html)列表实例的代码。
    例子:
       /// <summary>
         /// 生成不重复随机数列表实例
            
    /// </summary>
            
    /// <param name="count">不重复数数量</param>
            
    /// <returns>不重复数列表</returns>
            private static List<int> GetRandomList(int count)
            {
                List<int> list = new List<int>();
                int num = 0;
                Random rnd = new Random();
                for (int i = 0; i < count; i++)
                {
                    do
                    {
                        num = rnd.Next(0100001000000);
                    } while (list.Contains(num));//                
                    list.Add(num);
                }
                return list;
            }
  • 相关阅读:
    Chapter 1 Secondary Sorting:Introduction
    Apache Spark : RDD
    Apache Spark : Introduction
    Python 变量和数据类型
    CMP3$
    idea实现eclipse工作空间的思路
    Oracle 数据字典查询
    sql左连接、右连接、内连接、不写连接符号
    ADB
    Serverless
  • 原文地址:https://www.cnblogs.com/linuxnotes/p/3577664.html
Copyright © 2020-2023  润新知