C# 生成随机数的代码
2021-07-22 00:12
                         标签:span   http   操作   clear   parent   back   str   tools   poi     以上就是本文的全部内容了,希望大家能够喜欢,能够对大家学习C#有所帮助。  本文地址:  http://www.paobuke.com/develop/c-develop/pbk23093.html C# 生成随机数的代码 标签:span   http   操作   clear   parent   back   str   tools   poi    原文地址:http://www.cnblogs.com/paobuke/p/8035658.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;
 }
   C# 生成随机数的代码相关内容
![]()
![]()
![]()
![]()
上一篇:c#与js随机数生成方法
下一篇:SpringBoot配置详解