zoukankan      html  css  js  c++  java
  • c#生成随机数示例分享

    c#生成(随机数 http://www.jbxue.com/tags/suijishu.html)的代码。
    /// 构造随机数 种子
    static int GetRandomSeed()
    {
                byte[] bytes = new byte[4];
                System.Security.Cryptography.RNGCryptoServiceProvider rng = new System.Security.Cryptography.RNGCryptoServiceProvider();
                rng.GetBytes(bytes);
                return BitConverter.ToInt32(bytes, 0);

    ///  生成随机 数
    static int rnd()  
    {     
                Random ran = new Random(GetRandomSeed());         
                int cnt = ran.Next(0,59);
                return cnt;
     }
  • 相关阅读:
    双循环解决添加列表问题
    贪心算法
    隔板法发红包
    python小兵之时间模块
    开发规范
    python 小兵(12)模块1
    Linux系统
    刷题
    Socket
    栈和队列
  • 原文地址:https://www.cnblogs.com/linuxnotes/p/3577662.html
Copyright © 2011-2022 走看看